Documentation ¶
Index ¶
- Constants
- Variables
- func ApiEndpoint(documentedApiEndpoint string, region string) string
- func FormatInstance(name string, description string, crn Crn) string
- func Ls(apikey, region string, resourceGroupName string, fast bool) error
- func LsCommon(apikey string, token string, accountID string, region string, ...) error
- func LsWithToken(token string, accountID string, region string, resourceGroupName string, ...) error
- func PrintResourceInstances(context *Context, fast bool, ...)
- func ResourceInstances(service *resourcecontrollerv2.ResourceControllerV2, ...) ([]resourcecontrollerv2.ResourceInstance, error)
- func ResourceKeys(service *resourcecontrollerv2.ResourceControllerV2, ...) ([]resourcecontrollerv2.ResourceKey, error)
- func Rm(apikey, region string, resourceGroupName string, fileName string) error
- func RmCommon(apikey string, token string, accountID string, region string, ...) error
- func RmServiceInstances(serviceInstances []*ResourceInstanceWrapper) error
- func RmWithToken(token string, accountID string, region string, resourceGroupName string, ...) error
- func SetGlobalContext(apikey string, token string, accountID string, region string, ...) error
- func SetGlobalContextResourceGroupID() error
- func Tag(apikey, resourceGroup string) error
- func Tst(apikey, region string, resourceGroupName string) error
- func TstCommon(apikey string, token string, accountID string, region string, ...) error
- func TstServiceInstances(serviceInstances []*ResourceInstanceWrapper) error
- type Context
- type Crn
- type Key
- type KeyprotectServiceOpertions
- type ResourceInstanceOperations
- type ResourceInstanceWrapper
- type ResourceKeyOperations
- type TransitGatewayServiceOpertions
- type TypicalServiceOperations
- type UnimplementedServiceOperations
- type VpcGenericInstanceGroupOperation
- type VpcGenericNoDeleteOperation
- type VpcGenericOperation
- type VpcSpecificFloatingIPInstance
- type VpcSpecificFlowLogCollectorInstance
- type VpcSpecificImageInstance
- type VpcSpecificInstanceGroupInstance
- type VpcSpecificInstanceInstance
- type VpcSpecificInstanceTemplateInstance
- type VpcSpecificKeyInstance
- type VpcSpecificLoadBalancerInstance
- type VpcSpecificNetworkACLInstance
- type VpcSpecificPublicGatewayInstance
- type VpcSpecificSecurityGroupInstance
- type VpcSpecificSubnetInstance
- type VpcSpecificVPCInstance
- type VpcSpecificVPNGatewayInstance
- type VpcSpecificVolumeInstance
- type VpcSubtypeOperations
Constants ¶
const ( SIStateStart = iota // filled with crn, no network activity SIStateExists // cloud state has been fetched SIStateDestroying // was in the exists state, a cloud call to delete was successful SIStateDeleted // was in the destroying state, a cloud call to find it was successful but not found )
Service instance state State transition start -Fetch-> exists | deleted exists -Fetch-> exists exists -Fetch-> deleted exists -Destroy-> destroying destroying -Fetch-> exists destroying -Fetch-> destroying destroying -Fetch-> deleted
See further definition of Fetch and Destroy below
Variables ¶
var VpcSubtypeOperationsIrregularMap = map[string]VpcSubtypeOperations{ "instance-template": VpcSpecificInstanceTemplateInstance{}, "vpn": VpcSpecificVPNGatewayInstance{}, }
var VpcSubtypeOperationsMap = map[string]VpcSubtypeOperations{ "vpc": VpcSpecificVPCInstance{}, "subnet": VpcSpecificSubnetInstance{}, "instance": VpcSpecificInstanceInstance{}, "volume": VpcSpecificVolumeInstance{}, "key": VpcSpecificKeyInstance{}, "load-balancer": VpcSpecificLoadBalancerInstance{}, "floating-ip": VpcSpecificFloatingIPInstance{}, "image": VpcSpecificImageInstance{}, "public-gateway": VpcSpecificPublicGatewayInstance{}, "network-acl": VpcSpecificNetworkACLInstance{}, "security-group": VpcSpecificSecurityGroupInstance{}, "flow-log-collector": VpcSpecificFlowLogCollectorInstance{}, "instance-group": VpcSpecificInstanceGroupInstance{}, }
Functions ¶
func ApiEndpoint ¶
func LsWithToken ¶
func LsWithToken(token string, accountID string, region string, resourceGroupName string, resourceGroupID string, fast bool) error
ls with context manager from ibmcloud cli
func PrintResourceInstances ¶
func PrintResourceInstances(context *Context, fast bool, wrappedResourceInstances []*ResourceInstanceWrapper)
func ResourceInstances ¶
func ResourceInstances(service *resourcecontrollerv2.ResourceControllerV2, lrio *resourcecontrollerv2.ListResourceInstancesOptions) ([]resourcecontrollerv2.ResourceInstance, error)
Return the list of resource instances matching the option
func ResourceKeys ¶
func ResourceKeys(service *resourcecontrollerv2.ResourceControllerV2, lrio *resourcecontrollerv2.ListResourceKeysOptions) ([]resourcecontrollerv2.ResourceKey, error)
Return the list of service keys matching the option
func RmServiceInstances ¶
func RmServiceInstances(serviceInstances []*ResourceInstanceWrapper) error
State transition start -fetch-> exists | deleted exists -fetch-> exists exists -fetch-> deleted exists -destroy-> destroying destroying -fetch-> exists destroying -fetch-> destroying destroying -fetch-> deleted
func RmWithToken ¶
func SetGlobalContext ¶
func SetGlobalContext(apikey string, token string, accountID string, region string, resourceGroupName string, resourceGroupID string) error
return the cached context or create it the first time called
func SetGlobalContextResourceGroupID ¶
func SetGlobalContextResourceGroupID() error
func TstServiceInstances ¶
func TstServiceInstances(serviceInstances []*ResourceInstanceWrapper) error
Types ¶
type Context ¶
type Context struct { IDToResourceGroupName map[string]string KeyProtectClients map[Key]*kp.Client TransitGatewayClient *transitgatewayapisv1.TransitGatewayApisV1 VpcClients map[string]*vpcv1.VpcV1 // contains filtered or unexported fields }
Global variables all the ones that end in Service are useful for operations
var GlobalContext *Context
func MustGlobalContext ¶
func MustGlobalContext() *Context
type Crn ¶
type Crn struct { Crn string // contains filtered or unexported fields }
Crn is the parsed representation of a crn string. TODO make the vpc stuff more general if needed
type KeyprotectServiceOpertions ¶
type KeyprotectServiceOpertions struct { }
--------------------------------------
func (*KeyprotectServiceOpertions) Destroy ¶
func (s *KeyprotectServiceOpertions) Destroy(si *ResourceInstanceWrapper)
func (*KeyprotectServiceOpertions) Fetch ¶
func (s *KeyprotectServiceOpertions) Fetch(si *ResourceInstanceWrapper)
kms removes itsef from the resource controller but continues to return a state of removed
func (*KeyprotectServiceOpertions) FormatInstance ¶
func (s *KeyprotectServiceOpertions) FormatInstance(si *ResourceInstanceWrapper, fast bool) string
type ResourceInstanceOperations ¶
type ResourceInstanceOperations interface { /* Fetch function - get the resource from the cloud, if there is an error that indicartes a successful API call with indication that the resource does not exist then resource changes to deleted (other failures do not change the state of the resource) */ Fetch(si *ResourceInstanceWrapper) // fetch from cloud and upate the state, no need to retry in Fetch /* Destroy - request a destroy of the resource. */ Destroy(si *ResourceInstanceWrapper) // fetch from cloud and upate the state, no need to retry in Fetch FormatInstance(si *ResourceInstanceWrapper, fast bool) string }
func NewVpcOperations ¶
func NewVpcOperations(crn *Crn) (ResourceInstanceOperations, error)
--------------------------------------
type ResourceInstanceWrapper ¶
type ResourceInstanceWrapper struct { //context *Context ResourceGroupID *string Name *string // contains filtered or unexported fields }
wrappers are for both resourcecontrollerv2.ResourceInstance and ServiceInstance. Also contain state
func List ¶
func List() ([]*ResourceInstanceWrapper, error)
func NewResourceInstanceWrapper ¶
func NewResourceInstanceWrapper(crn *Crn, resourceGroupID *string, name *string) *ResourceInstanceWrapper
func (*ResourceInstanceWrapper) Destroy ¶
func (ri *ResourceInstanceWrapper) Destroy()
func (*ResourceInstanceWrapper) Fetch ¶
func (ri *ResourceInstanceWrapper) Fetch()
func (*ResourceInstanceWrapper) FormatInstance ¶
func (ri *ResourceInstanceWrapper) FormatInstance(fast bool) string
func (*ResourceInstanceWrapper) ResourceGroup ¶
func (basic *ResourceInstanceWrapper) ResourceGroup() string
ResourceGroup returns a string representation of the resource group. Name if available
type ResourceKeyOperations ¶
type ResourceKeyOperations struct {
// contains filtered or unexported fields
}
--------------------------------------
func (*ResourceKeyOperations) Destroy ¶
func (s *ResourceKeyOperations) Destroy(si *ResourceInstanceWrapper)
func (*ResourceKeyOperations) Fetch ¶
func (s *ResourceKeyOperations) Fetch(si *ResourceInstanceWrapper)
func (*ResourceKeyOperations) FormatInstance ¶
func (s *ResourceKeyOperations) FormatInstance(si *ResourceInstanceWrapper, fast bool) string
type TransitGatewayServiceOpertions ¶
type TransitGatewayServiceOpertions struct { }
--------------------------------------
func (*TransitGatewayServiceOpertions) Destroy ¶
func (s *TransitGatewayServiceOpertions) Destroy(si *ResourceInstanceWrapper)
func (*TransitGatewayServiceOpertions) Fetch ¶
func (s *TransitGatewayServiceOpertions) Fetch(si *ResourceInstanceWrapper)
func (*TransitGatewayServiceOpertions) FormatInstance ¶
func (s *TransitGatewayServiceOpertions) FormatInstance(si *ResourceInstanceWrapper, fast bool) string
type TypicalServiceOperations ¶
type TypicalServiceOperations struct {
// contains filtered or unexported fields
}
--------------------------------------
func (*TypicalServiceOperations) Destroy ¶
func (s *TypicalServiceOperations) Destroy(si *ResourceInstanceWrapper)
func (*TypicalServiceOperations) Fetch ¶
func (s *TypicalServiceOperations) Fetch(si *ResourceInstanceWrapper)
func (*TypicalServiceOperations) FormatInstance ¶
func (s *TypicalServiceOperations) FormatInstance(si *ResourceInstanceWrapper, fast bool) string
type UnimplementedServiceOperations ¶
type UnimplementedServiceOperations struct { }
-------------------------------------- If the CRN can not be understood this unimplementedservice is used.
func (UnimplementedServiceOperations) Destroy ¶
func (s UnimplementedServiceOperations) Destroy(si *ResourceInstanceWrapper)
func (UnimplementedServiceOperations) Fetch ¶
func (s UnimplementedServiceOperations) Fetch(si *ResourceInstanceWrapper)
func (UnimplementedServiceOperations) FormatInstance ¶
func (s UnimplementedServiceOperations) FormatInstance(si *ResourceInstanceWrapper, fast bool) string
type VpcGenericInstanceGroupOperation ¶
type VpcGenericInstanceGroupOperation struct {
// contains filtered or unexported fields
}
-------------------------------------- instance-groups need the membership count set to zero before deleting.
func (*VpcGenericInstanceGroupOperation) Destroy ¶
func (vpc *VpcGenericInstanceGroupOperation) Destroy(ri *ResourceInstanceWrapper)
func (*VpcGenericInstanceGroupOperation) Fetch ¶
func (vpc *VpcGenericInstanceGroupOperation) Fetch(ri *ResourceInstanceWrapper)
func (*VpcGenericInstanceGroupOperation) FormatInstance ¶
func (vpc *VpcGenericInstanceGroupOperation) FormatInstance(ri *ResourceInstanceWrapper, fast bool) string
type VpcGenericNoDeleteOperation ¶
type VpcGenericNoDeleteOperation struct {
// contains filtered or unexported fields
}
-------------------------------------- Some operations, like security group and acl, do not need to be deleted, deleting the vpc will auto delete them And deleting the default will complain.
func (*VpcGenericNoDeleteOperation) Destroy ¶
func (noDelete *VpcGenericNoDeleteOperation) Destroy(ri *ResourceInstanceWrapper)
func (*VpcGenericNoDeleteOperation) Fetch ¶
func (noDelete *VpcGenericNoDeleteOperation) Fetch(ri *ResourceInstanceWrapper)
func (*VpcGenericNoDeleteOperation) FormatInstance ¶
func (noDelete *VpcGenericNoDeleteOperation) FormatInstance(ri *ResourceInstanceWrapper, fast bool) string
type VpcGenericOperation ¶
type VpcGenericOperation struct {
// contains filtered or unexported fields
}
IS operations
func (*VpcGenericOperation) Destroy ¶
func (vpc *VpcGenericOperation) Destroy(ri *ResourceInstanceWrapper)
func (*VpcGenericOperation) Fetch ¶
func (vpc *VpcGenericOperation) Fetch(ri *ResourceInstanceWrapper)
func (*VpcGenericOperation) FormatInstance ¶
func (vpc *VpcGenericOperation) FormatInstance(ri *ResourceInstanceWrapper, fast bool) string
type VpcSpecificFloatingIPInstance ¶
type VpcSpecificFloatingIPInstance struct{}
type VpcSpecificFlowLogCollectorInstance ¶
type VpcSpecificFlowLogCollectorInstance struct{}
type VpcSpecificImageInstance ¶
type VpcSpecificImageInstance struct{}
type VpcSpecificInstanceGroupInstance ¶
type VpcSpecificInstanceGroupInstance struct{}
type VpcSpecificInstanceInstance ¶
type VpcSpecificInstanceInstance struct{}
type VpcSpecificInstanceTemplateInstance ¶
type VpcSpecificInstanceTemplateInstance struct{}
type VpcSpecificKeyInstance ¶
type VpcSpecificKeyInstance struct{}
type VpcSpecificLoadBalancerInstance ¶
type VpcSpecificLoadBalancerInstance struct{}
type VpcSpecificNetworkACLInstance ¶
type VpcSpecificNetworkACLInstance struct{}
type VpcSpecificPublicGatewayInstance ¶
type VpcSpecificPublicGatewayInstance struct{}
type VpcSpecificSecurityGroupInstance ¶
type VpcSpecificSecurityGroupInstance struct{}
type VpcSpecificSubnetInstance ¶
type VpcSpecificSubnetInstance struct{}
type VpcSpecificVPCInstance ¶
type VpcSpecificVPCInstance struct{}
type VpcSpecificVPNGatewayInstance ¶
type VpcSpecificVPNGatewayInstance struct{}
These are irregular operations, notice the switch statements
type VpcSpecificVolumeInstance ¶
type VpcSpecificVolumeInstance struct{}