vpc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIBMCloudIAMApiEndpoint = "https://iam.cloud.ibm.com"
	KeyIBMCloudIAMApiEndpoint     = "IBMCLOUD_IAM_API_ENDPOINT"
	KeyIBMCloudApiKey             = "IBMCLOUD_API_KEY" // #nosec
)
View Source
const (
	DefaultRegion     = "us-south"
	KeyIBMCloudRegion = "IBMCLOUD_REGION"
)
View Source
const (
	KeyIBMCloudGtApiEndpoint     = "IBMCLOUD_GT_API_ENDPOINT"
	DefaultIBMCloudGtApiEndpoint = "https://tags.global-search-tagging.cloud.ibm.com"
)
View Source
const (
	AttachTagsOptionsTagTypeService = "service"
	AttachTagsOptionsTagTypeUser    = "user"
)
View Source
const (
	KeyIBMCloudIsApiEndpoint = "IBMCLOUD_IS_API_ENDPOINT"
)

Variables

View Source
var ErrorStockImageNotFound = errors.New("stock image was not found")
View Source
var InstanceNotFound = errors.New("instance was not found")

Functions

func CreateAuthenticator

func CreateAuthenticator(apiKey string, isIAMApiEndpoint string) (*core.IamAuthenticator, error)

func CreateVpcService

func CreateVpcService(apiKey string, isApiEndpoint string, isIAMApiEndpoint string) (*vpcv1.VpcV1, error)

func CreateVpcServiceFromEnv

func CreateVpcServiceFromEnv(env E.Environment) (*vpcv1.VpcV1, error)

func EnvFromDotEnv

func EnvFromDotEnv(root string) (env.Environment, error)

func FindInstance

func FindInstance(service *vpcv1.VpcV1, name string) (*vpcv1.Instance, error)

func FindLatestStockImage

func FindLatestStockImage(service *vpcv1.VpcV1) (string, error)

func Findimage

func Findimage(service *vpcv1.VpcV1, name string) (string, error)

func GetDefaultIBMCloudApiEndpoint

func GetDefaultIBMCloudApiEndpoint(region string) string

func GetIBMCloudApiEndpoint

func GetIBMCloudApiEndpoint(env E.Environment, defEndpoint string) string

func GetIBMCloudApiKey

func GetIBMCloudApiKey(env E.Environment) (string, error)

func GetIBMCloudGtApiEndpoint

func GetIBMCloudGtApiEndpoint(env E.Environment) string

func GetIBMCloudIAMApiEndpoint

func GetIBMCloudIAMApiEndpoint(env E.Environment, defEndpoint string) string

func GetRegion

func GetRegion(env E.Environment) string

func UnmarshalAttachTagsResponse

func UnmarshalAttachTagsResponse(m map[string]json.RawMessage, result any) (err error)

UnmarshalAttachTagsResponse unmarshals an instance of VPC from the specified map of raw messages.

func UnmarshalTag

func UnmarshalTag(m map[string]json.RawMessage, result any) (err error)

UnmarshalTag unmarshals an instance of Instance from the specified map of raw messages.

func UnmarshalTagCollection

func UnmarshalTagCollection(m map[string]json.RawMessage, result any) (err error)

UnmarshalTagCollection unmarshals an instance of TagCollection from the specified map of raw messages.

func UnmarshalTagCollectionFirst

func UnmarshalTagCollectionFirst(m map[string]json.RawMessage, result any) (err error)

UnmarshalTagCollectionFirst unmarshals an instance of TagCollectionFirst from the specified map of raw messages.

func UnmarshalTagCollectionNext

func UnmarshalTagCollectionNext(m map[string]json.RawMessage, result any) (err error)

UnmarshalTagCollectionNext unmarshals an instance of TagCollectionNext from the specified map of raw messages.

func UnmarshalTagResultsItem

func UnmarshalTagResultsItem(m map[string]json.RawMessage, result any) (err error)

UnmarshalTagResultsItem unmarshals an instance of VPC from the specified map of raw messages.

Types

type AttachTagsBody

type AttachTagsBody struct {
	// List of resources on which the tag or tags are attached.
	Resources []Resource `json:"resources"`
	// An array of tag names to attach
	TagNames []string `json:"tag_names"`
}

type AttachTagsOptions

type AttachTagsOptions struct {

	// The type of the tag. Supported values are user, service and access. service and access are not supported for IMS resources.
	TagType *string `json:"tag_type,omitempty"`

	// Allows users to set headers on API requests
	Headers map[string]string
}

AttachTagsOptions : The AttachTags options.

type AttachTagsResponse

type AttachTagsResponse struct {
	Results []TagResultsItem `json:"results"`
}

type GlobalTagging

type GlobalTagging struct {
	Service *core.BaseService

	// The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13`
	// and today's date (UTC).
	Version *string
	// contains filtered or unexported fields
}

func CreateGlobalTagging

func CreateGlobalTagging(options *GlobalTaggingOptions) (service *GlobalTagging, err error)

CreateGlobalTagging : constructs an Tag of GlobalTagging with passed in options.

func CreateTaggingServiceFromEnv

func CreateTaggingServiceFromEnv(env E.Environment) (*GlobalTagging, error)

func (*GlobalTagging) AttachTags

func (service *GlobalTagging) AttachTags(attachTagsOptions *AttachTagsOptions, payload *AttachTagsBody) (result *AttachTagsResponse, response *core.DetailedResponse, err error)

ListTags : List all Tags This request lists all Tags in the region.

func (*GlobalTagging) AttachTagsContext

func (service *GlobalTagging) AttachTagsContext(ctx context.Context, attachTagsOptions *AttachTagsOptions, payload *AttachTagsBody) (result *AttachTagsResponse, response *core.DetailedResponse, err error)

AttachTagsContext is an alternate form of the AttachTags method which supports a Context parameter

func (*GlobalTagging) GetEnableGzipCompression

func (service *GlobalTagging) GetEnableGzipCompression() bool

GetEnableGzipCompression returns the service's EnableGzipCompression field

func (*GlobalTagging) ListTags

func (service *GlobalTagging) ListTags(listTagsOptions *ListTagsOptions) (result *TagCollection, response *core.DetailedResponse, err error)

ListTags : List all Tags This request lists all Tags in the region.

func (*GlobalTagging) ListTagsWithContext

func (service *GlobalTagging) ListTagsWithContext(ctx context.Context, listTagsOptions *ListTagsOptions) (result *TagCollection, response *core.DetailedResponse, err error)

ListTagsWithContext is an alternate form of the ListTags method which supports a Context parameter

func (*GlobalTagging) NewTagsPager

func (service *GlobalTagging) NewTagsPager(options *ListTagsOptions) (pager *TagsPager, err error)

NewTagsPager returns a new TagsPager Tag.

type GlobalTaggingOptions

type GlobalTaggingOptions struct {
	URL           string
	Authenticator core.Authenticator

	// The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13`
	// and today's date (UTC).
	Version *string
}

type Image

type Image struct {
	ID      string
	Version *semver.Version
}

func FindStockImages

func FindStockImages(service *vpcv1.VpcV1) ([]Image, error)

type ListTagsOptions

type ListTagsOptions struct {
	// A server-provided token determining what resource to start the page on.
	Start *string `json:"start,omitempty"`

	// The number of resources to return on a page.
	Limit *int64 `json:"limit,omitempty"`

	// The type of the tag you want to list. Supported values are user, service and access.
	TagType *string `json:"tag_type,omitempty"`

	// If you want to return only the list of tags that are attached to a specified resource, pass the ID of the resource on this parameter. For resources that are onboarded to Global Search and Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID. When using this parameter, you must specify the appropriate provider (ims or ghost).
	AttachedTo *string `json:"attached_to,omitempty"`

	// Select a provider. Supported values are ghost and ims. To list both Global Search and Tagging tags and infrastructure tags, use ghost,ims. service and access tags can only be attached to resources that are onboarded to Global Search and Tagging, so you should not set this parameter to list them.
	Providers []string `json:"providers,omitempty"`

	// Allows users to set headers on API requests
	Headers map[string]string
}

ListTagsOptions : The ListTags options.

type Resource

type Resource struct {
	// The CRN or IMS ID of the resource
	ResourceID string `json:"resource_id"`
	// The IMS resource type of the resource
	ResourceType *string `json:"resource_type,omitempty"`
}

type Tag

type Tag struct {
	Name string `json:"name"`
}

type TagCollection

type TagCollection struct {
	// A link to the first page of resources.
	First *TagCollectionFirst `json:"first" validate:"required"`

	// Collection of virtual server Tags.
	Tags []Tag `json:"Tags" validate:"required"`

	// The maximum number of resources that can be returned by the request.
	Limit *int64 `json:"limit" validate:"required"`

	// A link to the next page of resources. This property is present for all pages
	// except the last page.
	Next *TagCollectionNext `json:"next,omitempty"`

	// The total number of resources across all pages.
	TotalCount *int64 `json:"total_count" validate:"required"`
}

TagCollection : TagCollection struct

type TagCollectionFirst

type TagCollectionFirst struct {
	// The URL for a page of resources.
	Href *string `json:"href" validate:"required"`
}

TagCollectionFirst : A link to the first page of resources.

type TagCollectionNext

type TagCollectionNext struct {
	// The URL for a page of resources.
	Href *string `json:"href" validate:"required"`
}

TagCollectionNext : A link to the next page of resources. This property is present for all pages except the last page.

type TagResultsItem

type TagResultsItem struct {
	// The CRN or IMS ID of the resource
	ResourceID string `json:"resource_id"`
	// It is true if the operation exits with an error.
	IsError bool `json:"is_error"`
}

type TagsPager

type TagsPager struct {
	// contains filtered or unexported fields
}

TagsPager can be used to simplify the use of the "ListTags" method.

func (*TagsPager) GetAll

func (pager *TagsPager) GetAll() (allItems []Tag, err error)

GetAll invokes GetAllWithContext() using context.Background() as the Context parameter.

func (*TagsPager) GetAllWithContext

func (pager *TagsPager) GetAllWithContext(ctx context.Context) (allItems []Tag, err error)

GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly until all pages of results have been retrieved.

func (*TagsPager) GetNext

func (pager *TagsPager) GetNext() (page []Tag, err error)

GetNext invokes GetNextWithContext() using context.Background() as the Context parameter.

func (*TagsPager) GetNextWithContext

func (pager *TagsPager) GetNextWithContext(ctx context.Context) (page []Tag, err error)

GetNextWithContext returns the next page of results using the specified Context.

func (*TagsPager) HasNext

func (pager *TagsPager) HasNext() bool

HasNext returns true if there are potentially more results to be retrieved.

Jump to

Keyboard shortcuts

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