client

package
v0.0.0-...-2ac3827 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	INSTANCE_DEFAULT_MASK = "id, globalIdentifier, hostname, hourlyBillingFlag, domain, fullyQualifiedDomainName, status.name, " +
		"powerState.name, activeTransaction, datacenter.name, account.id, " +
		"maxCpu, maxMemory, primaryIpAddress, primaryBackendIpAddress, " +
		"privateNetworkOnlyFlag, dedicatedAccountHostOnlyFlag, dedicatedHost, createDate, modifyDate, " +
		"billingItem[orderItem.order.userRecord.username, recurringFee], notes, tagReferences.tag.name"

	INSTANCE_DETAIL_MASK = "id, globalIdentifier, hostname, domain, fullyQualifiedDomainName, status.name, " +
		"powerState.name, activeTransaction, datacenter.name, " +
		"operatingSystem[softwareLicense[softwareDescription[name,version]],passwords[username,password]], " +
		" maxCpu, maxMemory, primaryIpAddress, primaryBackendIpAddress, " +
		"privateNetworkOnlyFlag, dedicatedAccountHostOnlyFlag, dedicatedHost, createDate, modifyDate, " +
		"billingItem[nextInvoiceTotalRecurringAmount, children[nextInvoiceTotalRecurringAmount]], notes, tagReferences.tag.name, networkVlans[id,vlanNumber,networkSpace], " +
		"primaryBackendNetworkComponent[primaryIpAddress, networkVlan[id,name,vlanNumber,primaryRouter], subnets[netmask,networkIdentifier]], primaryNetworkComponent[primaryIpAddress, networkVlan[id,name,vlanNumber,primaryRouter], subnets[netmask,networkIdentifier]]"

	INSTANCE_ID_MASK = "id"

	INSTANCE_NETWORK_COMPONENTS_MASK = "" /* 257-byte string literal not displayed */

	NETWORK_DEFAULT_VLAN_MASK   = "id,primarySubnetId,networkSpace"
	NETWORK_DEFAULT_SUBNET_MASK = "id,networkVlanId,addressSpace"

	VOLUME_DEFAULT_MASK = "" /* 177-byte string literal not displayed */

	ALLOWD_HOST_DEFAULT_MASK = "id, name, credential[username, password]"

	VOLUME_DETAIL_MASK = "id,username,password,capacityGb,snapshotCapacityGb,parentVolume.snapshotSizeBytes,storageType.keyName," +
		"serviceResource.datacenter.name,serviceResourceBackendIpAddress,iops,lunId,activeTransactionCount," +
		"activeTransactions.transactionStatus.friendlyName,replicationPartnerCount,replicationStatus," +
		"replicationPartners[id,username,serviceResourceBackendIpAddress,serviceResource.datacenter.name,replicationSchedule.type.keyname]"

	IMAGE_DEFAULT_MASK = "id, name, globalIdentifier, imageType, accountId"

	IMAGE_DETAIL_MASK = "" /* 228-byte string literal not displayed */

	EPHEMERAL_DISK_CATEGORY_CODE = "guest_disk1"

	UPGRADE_VIRTUAL_SERVER_ORDER_TYPE = "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade"

	NETWORK_PERFORMANCE_STORAGE_PACKAGE_ID = 222
	NETWORK_STORAGE_AS_SERVICE_PACKAGE_ID  = 759

	SOFTLAYER_PUBLIC_EXCEPTION                      = "SoftLayer_Exception_Public"
	SOFTLAYER_OBJECTNOTFOUND_EXCEPTION              = "SoftLayer_Exception_ObjectNotFound"
	SOFTLAYER_BLOCKINGOPERATIONINPROGRESS_EXCEPTION = "SoftLayer_Exception_Network_Storage_BlockingOperationInProgress"
	SOFTLAYER_GROUP_ACCESSCONTROLERROR_EXCEPTION    = "SoftLayer_Exception_Network_Storage_Group_AccessControlError"
	SOFTLAYER_NOTIMPLEMENTED_EXCEPTION              = "SoftLayer_Exception_NotImplemented"
)
View Source
const (
	SoftlayerAPIEndpointPublicDefault  = "https://api.softlayer.com/rest/v3.1"
	SoftlayerAPIEndpointPrivateDefault = "https://api.service.softlayer.com/rest/v3.1"
	SoftlayerGoLogTag                  = "softlayerGo"
)

Variables

This section is empty.

Functions

func FindPerformanceIOPSPrice

func FindPerformanceIOPSPrice(productPackage datatypes.Product_Package, size int, iops int) (datatypes.Product_Item_Price, error)

Find the price in the given package with the specified size and iops

func FindPerformancePrice

func FindPerformancePrice(productPackage datatypes.Product_Package, priceCategory string) (datatypes.Product_Item_Price, error)

Find the price in the given package that has the specified category

func FindPerformanceSpacePrice

func FindPerformanceSpacePrice(productPackage datatypes.Product_Package, size int) (datatypes.Product_Item_Price, error)

Find the price in the given package with the specified size

func FindSaaSPerformIopsPrice

func FindSaaSPerformIopsPrice(productPackage datatypes.Product_Package, size int, iops int) (datatypes.Product_Item_Price, error)

func FindSaaSPerformSpacePrice

func FindSaaSPerformSpacePrice(productPackage datatypes.Product_Package, size int) (datatypes.Product_Item_Price, error)

func FindSaaSPriceByCategory

func FindSaaSPriceByCategory(productPackage datatypes.Product_Package, price_category string) (datatypes.Product_Item_Price, error)

func FindSaaSSnapshotSpacePrice

func FindSaaSSnapshotSpacePrice(productPackage datatypes.Product_Package, size int, iops int) (datatypes.Product_Item_Price, error)

func NewLargeObject

func NewLargeObject(c *swift.Connection, path string, concurrency int, partSize int64, expireAfter int64, logger cpiLogger.Logger) (*largeObject, error)

NewLargeObject provides a io.writer to upload data as a segmented upload

It will upload all the segments into a second container named <container>. These segments will have names like large_file/1290206778.25/00000000, large_file/1290206778.25/00000001, etc.

The main benefit for using a separate container is that the main container listings will not be polluted with all the segment names. The reason for using the segment name format of <name>/<timestamp>/<segment> is so that an upload of a new file with the same name won’t overwrite the contents of the first until the last moment when the manifest file is updated.

swift will manage these segment files for you, deleting old segments on deletes and overwrites, etc. You can override this behavior with the --leave-segments option if desired; this is useful if you want to have multiple versions of the same large object available.

func NewSoftlayerClientSession

func NewSoftlayerClientSession(apiEndpoint string, username string, password string, trace bool, timeoutSec int, retries int, retryWaitSec int, outLogger *log.Logger) *session.Session

func NewSwiftClient

func NewSwiftClient(swiftEndpoint string, swiftUsername string, swiftPassword string, timeoutSec int, retries int) *swift.Connection

Types

type Client

type Client interface {
	CancelInstance(id int) error
	CreateInstance(template *datatypes.Virtual_Guest, userData *registry.SoftlayerUserData) (*datatypes.Virtual_Guest, error)
	EditInstance(id int, template *datatypes.Virtual_Guest) (bool, error)
	GetInstance(id int, mask string) (*datatypes.Virtual_Guest, bool, error)
	GetInstanceByPrimaryBackendIpAddress(ip string) (*datatypes.Virtual_Guest, bool, error)
	GetInstanceByPrimaryIpAddress(ip string) (*datatypes.Virtual_Guest, bool, error)
	RebootInstance(id int, soft bool, hard bool) error
	ReloadInstance(id int, stemcellId int, sshKeyIds []int, hostname string, domain string, userData *registry.SoftlayerUserData) error
	UpgradeInstanceConfig(id int, cpu int, memory int, network int, privateCPU bool, dedicatedHost bool) error
	UpgradeInstance(id int, cpu int, memory int, network int, privateCPU bool, dedicatedHost bool, secondDiskSize int) (int, error)
	WaitInstanceUntilReady(id int, until time.Time) error
	WaitInstanceUntilReadyWithTicket(id int, until time.Time) error
	WaitInstanceHasActiveTransaction(id int, until time.Time) error
	WaitInstanceHasNoneActiveTransaction(id int, until time.Time) error
	WaitVolumeProvisioningWithOrderId(orderId int, until time.Time) (*datatypes.Network_Storage, error)
	SetTags(id int, tags string) (bool, error)
	SetInstanceMetadata(id int, encodedUserData *string) (bool, error)
	AttachSecondDiskToInstance(id int, diskSize int) error
	GetInstanceAllowedHost(id int) (*datatypes.Network_Storage_Allowed_Host, bool, error)
	AuthorizeHostToVolume(instance *datatypes.Virtual_Guest, volumeId int, until time.Time) (bool, error)
	DeauthorizeHostToVolume(instance *datatypes.Virtual_Guest, volumeId int, until time.Time) (bool, error)
	CreateVolume(location string, size int, iops int, snapshotSpace int) (*datatypes.Network_Storage, error)
	OrderBlockVolume(storageType string, location string, size int, iops int) (*datatypes.Container_Product_Order_Receipt, error)
	OrderBlockVolume2(storageType string, location string, size int, iops int, snapshotSpace int) (*datatypes.Container_Product_Order_Receipt, error)
	CancelBlockVolume(volumeId int, reason string, immediate bool) (bool, error)
	GetBlockVolumeDetails(volumeId int, mask string) (*datatypes.Network_Storage, bool, error)
	GetBlockVolumeDetailsBySoftLayerAccount(volumeId int, mask string) (datatypes.Network_Storage, error)
	GetNetworkStorageTarget(volumeId int, mask string) (string, bool, error)
	SetNotes(id int, notes string) (bool, error)
	GetImage(imageId int, mask string) (*datatypes.Virtual_Guest_Block_Device_Template_Group, bool, error)
	GetVlan(id int, mask string) (*datatypes.Network_Vlan, bool, error)
	GetSubnet(id int, mask string) (*datatypes.Network_Subnet, bool, error)
	GetAllowedHostCredential(id int) (*datatypes.Network_Storage_Allowed_Host, bool, error)
	GetAllowedNetworkStorage(id int) ([]string, bool, error)
	CreateSshKey(label *string, key *string, fingerPrint *string) (*datatypes.Security_Ssh_Key, error)
	DeleteSshKey(id int) (bool, error)

	CreateInstanceFromVPS(template *datatypes.Virtual_Guest, stemcellID int, sshKeys []int, userData *registry.SoftlayerUserData) (*datatypes.Virtual_Guest, error)
	DeleteInstanceFromVPS(id int) error

	CreateSnapshot(volumeId int, notes string) (datatypes.Network_Storage, error)
	DeleteSnapshot(snapshotId int) error

	CreateTicket(ticketSubject *string, ticketTitle *string, contents *string, attachmentId *int, attachmentType *string) error

	CreateSwiftContainer(containerName string) error
	DeleteSwiftContainer(containerName string) error
	UploadSwiftLargeObject(containerName string, objectName string, objectFile string) error
	DeleteSwiftLargeObject(containerName string, objectFileName string) error

	CreateImageFromExternalSource(imageName string, note string, cluster string, osCode string) (int, error)
}

go:generate counterfeiter -o fakes/fake_client.go . Client

type ClientFactory

type ClientFactory interface {
	CreateClient() Client
}

go:generate counterfeiter -o fakes/fake_client_factory.go . ClientFactory

func NewClientFactory

func NewClientFactory(slClient *ClientManager) ClientFactory

type ClientManager

type ClientManager struct {
	VirtualGuestService   services.Virtual_Guest
	AccountService        services.Account
	PackageService        services.Product_Package
	OrderService          services.Product_Order
	StorageService        services.Network_Storage
	BillingService        services.Billing_Item
	LocationService       services.Location_Datacenter
	NetworkVlanService    services.Network_Vlan
	NetworkSubnetService  services.Network_Subnet
	ImageService          services.Virtual_Guest_Block_Device_Template_Group
	SecuritySshKeyService services.Security_Ssh_Key
	BillingOrderService   services.Billing_Order
	TicketService         services.Ticket
	TicketSubjectSerivce  services.Ticket_Subject
	// contains filtered or unexported fields
}

func NewSoftLayerClientManager

func NewSoftLayerClientManager(session *session.Session, vps *vpsVm.Client, swfitClient *swift.Connection, logger logger.Logger) *ClientManager

func (*ClientManager) AttachSecondDiskToInstance

func (c *ClientManager) AttachSecondDiskToInstance(id int, diskSize int) error

func (*ClientManager) AuthorizeHostToVolume

func (c *ClientManager) AuthorizeHostToVolume(instance *datatypes.Virtual_Guest, volumeId int, until time.Time) (bool, error)

func (*ClientManager) CancelBlockVolume

func (c *ClientManager) CancelBlockVolume(volumeId int, reason string, immediate bool) (bool, error)

func (*ClientManager) CancelInstance

func (c *ClientManager) CancelInstance(id int) error

func (*ClientManager) CreateImageFromExternalSource

func (c *ClientManager) CreateImageFromExternalSource(imageName string, note string, cluster string, osCode string) (int, error)

func (*ClientManager) CreateInstance

func (c *ClientManager) CreateInstance(template *datatypes.Virtual_Guest, userData *registry.SoftlayerUserData) (*datatypes.Virtual_Guest, error)

func (*ClientManager) CreateInstanceFromVPS

func (c *ClientManager) CreateInstanceFromVPS(template *datatypes.Virtual_Guest,
	stemcellID int, sshKeys []int, userData *registry.SoftlayerUserData) (*datatypes.Virtual_Guest, error)

func (*ClientManager) CreateSnapshot

func (c *ClientManager) CreateSnapshot(volumeId int, notes string) (datatypes.Network_Storage, error)

Creates a snapshot on the given block volume. volumeId: The id of the volume notes: The notes or "name" to assign the snapshot

func (*ClientManager) CreateSshKey

func (c *ClientManager) CreateSshKey(label *string, key *string, fingerPrint *string) (*datatypes.Security_Ssh_Key, error)

func (*ClientManager) CreateSwiftContainer

func (c *ClientManager) CreateSwiftContainer(containerName string) error

func (*ClientManager) CreateTicket

func (c *ClientManager) CreateTicket(ticketSubject *string, ticketTitle *string, contents *string, attachmentId *int, attachmentType *string) error

func (*ClientManager) CreateVolume

func (c *ClientManager) CreateVolume(location string, size int, iops int, snapshotSpace int) (*datatypes.Network_Storage, error)

func (*ClientManager) DeauthorizeHostToVolume

func (c *ClientManager) DeauthorizeHostToVolume(instance *datatypes.Virtual_Guest, volumeId int, until time.Time) (bool, error)

func (*ClientManager) DeleteInstanceFromVPS

func (c *ClientManager) DeleteInstanceFromVPS(id int) error

func (*ClientManager) DeleteSnapshot

func (c *ClientManager) DeleteSnapshot(snapshotId int) error

Deletes the specified snapshot object. snapshotId: The ID of the snapshot object to delete.

func (*ClientManager) DeleteSshKey

func (c *ClientManager) DeleteSshKey(id int) (bool, error)

func (*ClientManager) DeleteSwiftContainer

func (c *ClientManager) DeleteSwiftContainer(containerName string) error

func (*ClientManager) DeleteSwiftLargeObject

func (c *ClientManager) DeleteSwiftLargeObject(containerName string, objectFileName string) error

func (*ClientManager) DisableSnapshots

func (c *ClientManager) DisableSnapshots(volumeId int, scheduleType string) error

Disables snapshots for a specific block volume at a given schedule. volumeId: The id of the volume scheduleType: 'HOURLY'|'DAILY'|'WEEKLY'

func (*ClientManager) EditInstance

func (c *ClientManager) EditInstance(id int, template *datatypes.Virtual_Guest) (bool, error)

func (*ClientManager) EnableSnapshot

func (c *ClientManager) EnableSnapshot(volumeId int, scheduleType string, retentionCount int, minute int, hour int, dayOfWeek string) error

Enables snapshots for a specific block volume at a given schedule. volumeId: The id of the volume scheduleType: 'HOURLY'|'DAILY'|'WEEKLY' retentionCount: Number of snapshots to be kept minute: Minute when to take snapshot hour: Hour when to take snapshot dayOfWeek: Day when to take snapshot

func (*ClientManager) GetAllowedHostCredential

func (c *ClientManager) GetAllowedHostCredential(id int) (*datatypes.Network_Storage_Allowed_Host, bool, error)

func (*ClientManager) GetAllowedNetworkStorage

func (c *ClientManager) GetAllowedNetworkStorage(id int) ([]string, bool, error)

func (*ClientManager) GetBlockVolumeDetails

func (c *ClientManager) GetBlockVolumeDetails(volumeId int, mask string) (*datatypes.Network_Storage, bool, error)

func (*ClientManager) GetBlockVolumeDetailsBySoftLayerAccount

func (c *ClientManager) GetBlockVolumeDetailsBySoftLayerAccount(volumeId int, mask string) (datatypes.Network_Storage, error)

func (*ClientManager) GetImage

func (*ClientManager) GetInstance

func (c *ClientManager) GetInstance(id int, mask string) (*datatypes.Virtual_Guest, bool, error)

func (*ClientManager) GetInstanceAllowedHost

func (c *ClientManager) GetInstanceAllowedHost(id int) (*datatypes.Network_Storage_Allowed_Host, bool, error)

func (*ClientManager) GetInstanceByPrimaryBackendIpAddress

func (c *ClientManager) GetInstanceByPrimaryBackendIpAddress(ip string) (*datatypes.Virtual_Guest, bool, error)

func (*ClientManager) GetInstanceByPrimaryIpAddress

func (c *ClientManager) GetInstanceByPrimaryIpAddress(ip string) (*datatypes.Virtual_Guest, bool, error)

func (*ClientManager) GetLocationId

func (c *ClientManager) GetLocationId(location string) (int, error)

func (*ClientManager) GetNetworkStorageTarget

func (c *ClientManager) GetNetworkStorageTarget(volumeId int, mask string) (string, bool, error)

func (*ClientManager) GetPackage

func (c *ClientManager) GetPackage(categoryCode string) (datatypes.Product_Package, error)

func (*ClientManager) GetPerformanceIscsiPackage

func (c *ClientManager) GetPerformanceIscsiPackage() (datatypes.Product_Package, error)

func (*ClientManager) GetStorageAsServicePackage

func (c *ClientManager) GetStorageAsServicePackage() (datatypes.Product_Package, error)

func (*ClientManager) GetSubnet

func (c *ClientManager) GetSubnet(id int, mask string) (*datatypes.Network_Subnet, bool, error)

func (*ClientManager) GetVlan

func (c *ClientManager) GetVlan(id int, mask string) (*datatypes.Network_Vlan, bool, error)

func (*ClientManager) OrderBlockVolume

func (c *ClientManager) OrderBlockVolume(storageType string, location string, size int, iops int) (*datatypes.Container_Product_Order_Receipt, error)

func (*ClientManager) OrderBlockVolume2

func (c *ClientManager) OrderBlockVolume2(storageType string, location string, size int, iops int, snapshotSpace int) (*datatypes.Container_Product_Order_Receipt, error)

func (*ClientManager) RebootInstance

func (c *ClientManager) RebootInstance(id int, soft bool, hard bool) error

func (*ClientManager) ReloadInstance

func (c *ClientManager) ReloadInstance(id int, stemcellId int, sshKeyIds []int, hostname string, domain string, userData *registry.SoftlayerUserData) error

func (*ClientManager) RestoreFromSnapshot

func (c *ClientManager) RestoreFromSnapshot(volumeId int, snapshotId int) error

Restores a specific volume from a snapshot. volumeId: The id of the volume snapshotId: The id of the restore point

func (*ClientManager) SetInstanceMetadata

func (c *ClientManager) SetInstanceMetadata(id int, encodedUserData *string) (bool, error)

func (*ClientManager) SetNotes

func (c *ClientManager) SetNotes(id int, notes string) (bool, error)

func (*ClientManager) SetTags

func (c *ClientManager) SetTags(id int, tags string) (bool, error)

func (*ClientManager) SetUserDataWithID

func (c *ClientManager) SetUserDataWithID(id int, userData *registry.SoftlayerUserData) error

func (*ClientManager) UpgradeInstance

func (c *ClientManager) UpgradeInstance(id int, cpu int, memory int, network int, privateCPU bool, dedicatedHost bool, secondDiskSize int) (int, error)

func (*ClientManager) UpgradeInstanceConfig

func (c *ClientManager) UpgradeInstanceConfig(id int, cpu int, memory int, network int, privateCPU bool, dedicatedHost bool) error

func (*ClientManager) UploadSwiftLargeObject

func (c *ClientManager) UploadSwiftLargeObject(containerName string, objectName string, objectFile string) error

func (*ClientManager) WaitInstanceHasActiveTransaction

func (c *ClientManager) WaitInstanceHasActiveTransaction(id int, until time.Time) error

func (*ClientManager) WaitInstanceHasNoneActiveTransaction

func (c *ClientManager) WaitInstanceHasNoneActiveTransaction(id int, until time.Time) error

func (*ClientManager) WaitInstanceUntilReady

func (c *ClientManager) WaitInstanceUntilReady(id int, until time.Time) error

Check the virtual server instance is ready for use

func (*ClientManager) WaitInstanceUntilReadyWithTicket

func (c *ClientManager) WaitInstanceUntilReadyWithTicket(id int, until time.Time) error

@TODO: The method is experimental and needed to verify.

func (*ClientManager) WaitOrderCompleted

func (c *ClientManager) WaitOrderCompleted(id int, until time.Time) error

func (*ClientManager) WaitVolumeProvisioningWithOrderId

func (c *ClientManager) WaitVolumeProvisioningWithOrderId(orderId int, until time.Time) (*datatypes.Network_Storage, error)

type Product_Item_Price_Sorted_Data

type Product_Item_Price_Sorted_Data []datatypes.Product_Item_Price

func (Product_Item_Price_Sorted_Data) Len

func (sorted_data Product_Item_Price_Sorted_Data) Len() int

func (Product_Item_Price_Sorted_Data) Less

func (sorted_data Product_Item_Price_Sorted_Data) Less(i, j int) bool

func (Product_Item_Price_Sorted_Data) Swap

func (sorted_data Product_Item_Price_Sorted_Data) Swap(i, j int)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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