wait

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 9

Documentation

Index

Constants

View Source
const (
	CreateSuccess         = "CREATED"
	VolumeAvailableStatus = "AVAILABLE"
	DeleteSuccess         = "DELETED"

	ErrorStatus = "ERROR"

	ServerActiveStatus      = "ACTIVE"
	ServerResizingStatus    = "RESIZING"
	ServerInactiveStatus    = "INACTIVE"
	ServerDeallocatedStatus = "DEALLOCATED"
	ServerRescueStatus      = "RESCUE"

	RequestCreateAction  = "CREATE"
	RequestUpdateAction  = "UPDATE"
	RequestDeleteAction  = "DELETE"
	RequestCreatedStatus = "CREATED"
	RequestUpdatedStatus = "UPDATED"
	RequestDeletedStatus = "DELETED"
	RequestFailedStatus  = "FAILED"

	XRequestIDHeader = "X-Request-Id"
)

Variables

This section is empty.

Functions

func AddVolumeToServerWaitHandler added in v0.14.0

func AddVolumeToServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId, volumeId string) *wait.AsyncActionHandler[iaas.VolumeAttachment]

AddVolumeToServerWaitHandler will wait for a volume to be attached to a server

func CreateNetworkAreaWaitHandler

func CreateNetworkAreaWaitHandler(ctx context.Context, a APIClientInterface, organizationId, areaId string) *wait.AsyncActionHandler[iaas.NetworkArea]

CreateNetworkAreaWaitHandler will wait for network area creation

func CreateNetworkWaitHandler

func CreateNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, networkId string) *wait.AsyncActionHandler[iaas.Network]

CreateNetworkWaitHandler will wait for network creation using network id

func CreateServerWaitHandler added in v0.14.0

func CreateServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

CreateServerWaitHandler will wait for server creation

func CreateVolumeWaitHandler added in v0.14.0

func CreateVolumeWaitHandler(ctx context.Context, a APIClientInterface, projectId, volumeId string) *wait.AsyncActionHandler[iaas.Volume]

CreateVolumeWaitHandler will wait for volume creation

func DeallocateServerWaitHandler added in v0.16.0

func DeallocateServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

DeallocateServerWaitHandler will wait for server deallocation

func DeleteNetworkAreaWaitHandler

func DeleteNetworkAreaWaitHandler(ctx context.Context, a APIClientInterface, organizationId, areaId string) *wait.AsyncActionHandler[iaas.NetworkArea]

DeleteNetworkAreaWaitHandler will wait for network area deletion

func DeleteNetworkWaitHandler

func DeleteNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, networkId string) *wait.AsyncActionHandler[iaas.Network]

DeleteNetworkWaitHandler will wait for network deletion

func DeleteServerWaitHandler added in v0.14.0

func DeleteServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

DeleteServerWaitHandler will wait for volume deletion

func DeleteVolumeWaitHandler added in v0.14.0

func DeleteVolumeWaitHandler(ctx context.Context, a APIClientInterface, projectId, volumeId string) *wait.AsyncActionHandler[iaas.Volume]

DeleteVolumeWaitHandler will wait for volume deletion

func ProjectRequestWaitHandler added in v0.14.0

func ProjectRequestWaitHandler(ctx context.Context, a APIClientInterface, projectId, requestId string) *wait.AsyncActionHandler[iaas.Request]

ProjectRequestWaitHandler will wait for a request to succeed.

It receives a request ID that can be obtained from the "X-Request-Id" header in the HTTP response of any operation in the IaaS API. To get this response header, use the "runtime.WithCaptureHTTPResponse" method from the "core" packaghe to get the raw HTTP response of an SDK operation. Then, the value of the request ID can be obtained by accessing the header key which is defined in the constant "XRequestIDHeader" of this package.

Example usage:

var httpResp *http.Response
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)

err = iaasClient.AddPublicIpToServer(ctxWithHTTPResp, projectId, serverId, publicIpId).Execute()

requestId := httpResp.Header[wait.XRequestIDHeader][0]
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())

func RemoveVolumeFromServerWaitHandler added in v0.14.0

func RemoveVolumeFromServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId, volumeId string) *wait.AsyncActionHandler[iaas.VolumeAttachment]

RemoveVolumeFromServerWaitHandler will wait for a volume to be attached to a server

func RescueServerWaitHandler added in v0.16.0

func RescueServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

RescueServerWaitHandler will wait for server rescue

func ResizeServerWaitHandler added in v0.14.0

func ResizeServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) (h *wait.AsyncActionHandler[iaas.Server])

ResizeServerWaitHandler will wait for server resize It checks for an intermediate resizing status and only then waits for the server to become active

func StartServerWaitHandler added in v0.16.0

func StartServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

StartServerWaitHandler will wait for server start

func StopServerWaitHandler added in v0.16.0

func StopServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

StopServerWaitHandler will wait for server stop

func UnrescueServerWaitHandler added in v0.16.0

func UnrescueServerWaitHandler(ctx context.Context, a APIClientInterface, projectId, serverId string) *wait.AsyncActionHandler[iaas.Server]

UnrescueServerWaitHandler will wait for server unrescue

func UpdateNetworkAreaWaitHandler

func UpdateNetworkAreaWaitHandler(ctx context.Context, a APIClientInterface, organizationId, areaId string) *wait.AsyncActionHandler[iaas.NetworkArea]

UpdateNetworkAreaWaitHandler will wait for network area update

func UpdateNetworkWaitHandler

func UpdateNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, networkId string) *wait.AsyncActionHandler[iaas.Network]

UpdateNetworkWaitHandler will wait for network update

Types

type APIClientInterface

type APIClientInterface interface {
	GetNetworkAreaExecute(ctx context.Context, organizationId, areaId string) (*iaas.NetworkArea, error)
	GetProjectRequestExecute(ctx context.Context, projectId string, requestId string) (*iaas.Request, error)
	GetNetworkExecute(ctx context.Context, projectId, networkId string) (*iaas.Network, error)
	GetVolumeExecute(ctx context.Context, projectId string, volumeId string) (*iaas.Volume, error)
	GetServerExecute(ctx context.Context, projectId string, serverId string) (*iaas.Server, error)
	GetAttachedVolumeExecute(ctx context.Context, projectId string, serverId string, volumeId string) (*iaas.VolumeAttachment, error)
}

Interfaces needed for tests

Jump to

Keyboard shortcuts

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