resourcetypes

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package resourcetypes provides operations for listing available resource types, obtaining their properties schema, and generating example templates that can be customised to use as provider templates.

Example of listing available resource types:

listOpts := resourcetypes.ListOpts{
    SupportStatus: resourcetypes.SupportStatusSupported,
}

resourceTypes, err := resourcetypes.List(client, listOpts).Extract()
if err != nil {
    panic(err)
}
fmt.Println("Get Resource Type List")
for _, rt := range resTypes {
    fmt.Println(rt.ResourceType)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeSchema

type AttributeSchema struct {
	Description string       `json:"description,omitempty"`
	Type        PropertyType `json:"type"`
}

AttributeSchema is the schema of a resource attribute

type ConstraintSchema

type ConstraintSchema struct {
	Description      string            `json:"description,omitempty"`
	Range            *MinMaxConstraint `json:"range,omitempty"`
	Length           *MinMaxConstraint `json:"length,omitempty"`
	Modulo           *ModuloConstraint `json:"modulo,omitempty"`
	AllowedValues    *[]interface{}    `json:"allowed_values,omitempty"`
	AllowedPattern   *string           `json:"allowed_pattern,omitempty"`
	CustomConstraint *string           `json:"custom_constraint,omitempty"`
}

ConstraintSchema describes all possible types of constraints. Besides the description, only one other field is ever set at a time.

type GenerateTemplateOpts

type GenerateTemplateOpts struct {
	TemplateType GeneratedTemplateType `q:"template_type"`
}

GenerateTemplateOpts allows the filtering of collections through the API.

func (GenerateTemplateOpts) ToGenerateTemplateQuery

func (opts GenerateTemplateOpts) ToGenerateTemplateQuery() (string, error)

ToGenerateTemplateQuery formats a GenerateTemplateOpts into a query string.

type GenerateTemplateOptsBuilder

type GenerateTemplateOptsBuilder interface {
	ToGenerateTemplateQuery() (string, error)
}

GenerateTemplateOptsBuilder allows extensions to add additional parameters to the GenerateTemplate request.

type GeneratedTemplateType

type GeneratedTemplateType string
const (
	TemplateTypeHOT GeneratedTemplateType = "hot"
	TemplateTypeCFn GeneratedTemplateType = "cfn"
)

type GetSchemaResult

type GetSchemaResult struct {
	gophercloud.Result
}

GetSchemaResult represents the result of a GetSchema operation.

func GetSchema

func GetSchema(client *gophercloud.ServiceClient, resourceType string) (r GetSchemaResult)

GetSchema retreives the schema for a given resource type.

func (GetSchemaResult) Extract

func (r GetSchemaResult) Extract() (rts ResourceSchema, err error)

Extract returns a ResourceSchema object and is called after a GetSchema operation.

type ListOpts

type ListOpts struct {
	// Filters the resource type list by a regex on the name.
	NameRegex string `q:"name"`
	// Filters the resource list by the specified SupportStatus.
	SupportStatus SupportStatus `q:"support_status"`
	// Return descriptions as well as names of resource types
	WithDescription bool `q:"with_description"`
}

ListOpts allows the filtering of collections through the API.

func (ListOpts) ToResourceTypeListQuery

func (opts ListOpts) ToResourceTypeListQuery() (string, error)

ToResourceTypeListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToResourceTypeListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type ListResult

type ListResult struct {
	gophercloud.Result
}

ListResult represents the result of a List operation.

func List

func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) (r ListResult)

List makes a request against the API to list available resource types.

func (ListResult) Extract

func (r ListResult) Extract() (rts []ResourceTypeSummary, err error)

Extract returns a slice of ResourceTypeSummary objects and is called after a List operation.

type MinMaxConstraint

type MinMaxConstraint struct {
	Min float64 `json:"min,omitempty"`
	Max float64 `json:"max,omitempty"`
}

MinMaxConstraint is a type of constraint with minimum and maximum values. This is used for both Range and Length constraints.

type ModuloConstraint

type ModuloConstraint struct {
	Step   int `json:"step,omitempty"`
	Offset int `json:"offset,omitempty"`
}

ModuloConstraint constrains an integer to have a certain value given a particular modulus.

type PropertySchema

type PropertySchema struct {
	Type          PropertyType              `json:"type"`
	Description   string                    `json:"description,omitempty"`
	Default       interface{}               `json:"default,omitempty"`
	Constraints   []ConstraintSchema        `json:"constraints,omitempty"`
	Required      bool                      `json:"required"`
	Immutable     bool                      `json:"immutable"`
	UpdateAllowed bool                      `json:"update_allowed"`
	Schema        map[string]PropertySchema `json:"schema,omitempty"`
}

PropertySchema is the schema of a resource property.

type PropertyType

type PropertyType string

PropertyType represents the expected type of a property or attribute value.

const (
	// StringProperty indicates a string property type.
	StringProperty PropertyType = "string"
	// IntegerProperty indicates an integer property type.
	IntegerProperty PropertyType = "integer"
	// NumberProperty indicates a number property type. It may be an integer or
	// float.
	NumberProperty PropertyType = "number"
	// BooleanProperty indicates a boolean property type.
	BooleanProperty PropertyType = "boolean"
	// MapProperty indicates a map property type.
	MapProperty PropertyType = "map"
	// ListProperty indicates a list property type.
	ListProperty PropertyType = "list"
	// UntypedProperty indicates a property that could have any type.
	UntypedProperty PropertyType = "any"
)

type ResourceSchema

type ResourceSchema struct {
	ResourceType  string                     `json:"resource_type"`
	SupportStatus SupportStatusDetails       `json:"support_status"`
	Attributes    map[string]AttributeSchema `json:"attributes"`
	Properties    map[string]PropertySchema  `json:"properties"`
}

ResourceSchema is the schema for a resource type, its attributes, and properties.

type ResourceTypeSummary

type ResourceTypeSummary struct {
	ResourceType string `json:"resource_type"`
	Description  string `json:"description"`
}

ResourceTypeSummary contains the result of listing an available resource type.

type SupportStatus

type SupportStatus string

SupportStatus is a type for specifying by which support status to filter the list of resource types.

const (
	// SupportStatusUnknown is returned when the resource type does not have a
	// support status.
	SupportStatusUnknown SupportStatus = "UNKNOWN"
	// SupportStatusSupported indicates a resource type that is expected to
	// work.
	SupportStatusSupported SupportStatus = "SUPPORTED"
	// SupportStatusDeprecated indicates a resource type that is in the process
	// being removed, and may or may not be replaced by something else.
	SupportStatusDeprecated SupportStatus = "DEPRECATED"
	// SupportStatusHidden indicates a resource type that has been removed.
	// Existing stacks that contain resources of this type can still be
	// deleted or updated to remove the resources, but they may not actually
	// do anything any more.
	SupportStatusHidden SupportStatus = "HIDDEN"
	// SupportStatusUnsupported indicates a resource type that is provided for
	// preview or other purposes and should not be relied upon.
	SupportStatusUnsupported SupportStatus = "UNSUPPORTED"
)

type SupportStatusDetails

type SupportStatusDetails struct {
	Status         SupportStatus         `json:"status"`
	Message        string                `json:"message,omitempty"`
	Version        string                `json:"version,omitempty"`
	PreviousStatus *SupportStatusDetails `json:"previous_status,omitempty"`
}

SupportStatusDetails contains information about the support status of the resource and its history.

type TemplateResult

type TemplateResult struct {
	gophercloud.Result
}

TemplateResult represents the result of a Template get operation.

func GenerateTemplate

func GenerateTemplate(client *gophercloud.ServiceClient, resourceType string, opts GenerateTemplateOptsBuilder) (r TemplateResult)

GenerateTemplate retreives an example template for a given resource type.

func (TemplateResult) Extract

func (r TemplateResult) Extract() (template map[string]interface{}, err error)

Extract returns a Template object and is called after a Template get operation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL