helper

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateSystemClientSystem

func ActivateSystemClientSystem(ctx context.Context, clientAPI *apexClient.APIClient, systemID string, activateSystemClientSystem models.ActivationClientModel, storageType apexClient.StorageProductEnum) error

ActivateSystemClientSystem checks to see if the current platform (ie.powerflex or powerscale) is activated, if not it will activate it.

func AsyncCheckActivation

func AsyncCheckActivation(ctx context.Context, stop chan bool, err chan error, clientAPI *apexClient.APIClient, systemID string, activateSystemClientSystem models.ActivationAsyncClientModel, storageType apexClient.StorageProductEnum)

AsyncCheckActivation checks to see if the current platform (ie.powerflex or powerscale) is activated, if not it will activate it in a go routine.

func ConnectAccount

func ConnectAccount(clientAPI *client.APIClient, arn string) (*client.RedactedAwsAccountInstance, *http.Response, error)

ConnectAccount connects an aws account

func ConvertTimeToString

func ConvertTimeToString(pTime *time.Time) string

ConvertTimeToString converts time to string

func ConvertToStringSlice

func ConvertToStringSlice(typesSlice []types.String) []string

ConvertToStringSlice converts []types.String to []string

func CopyMobilityGroups

func CopyMobilityGroups(request client.ApiMobilityGroupsCopyRequest, input client.StartCopyInput) (*client.Job, *http.Response, error)

CopyMobilityGroups copies a Mobility Group

func CreateClone

CreateClone sends the create clone request

func CreateFilter

func CreateFilter(filter []string, key string) string

CreateFilter creates a filter query string

func CreateMobilityGroup

func CreateMobilityGroup(ctx context.Context, clientAPI *client.APIClient, plan models.MobilityGroupModel) (*client.Job, *http.Response, error)

CreateMobilityGroup creates a new Mobility Group

func CreateMobilityTarget

func CreateMobilityTarget(request client.ApiMobilityTargetsCreateRequest, input client.CreateTargetInput) (*client.Job, *http.Response, error)

CreateMobilityTarget sends the create mobility target request

func CreateStorageSystem

func CreateStorageSystem(client client.ApiStorageSystemsCreateRequest, systemCreateInput client.StorageSystemDeploymentRequest) (*client.Job, *http.Response, error)

CreateStorageSystem creates a storage system

func DisconnectAccount

func DisconnectAccount(clientAPI *client.APIClient, accountID string) (*client.Job, *http.Response, error)

DisconnectAccount disconnects an aws account

func GenerateAwsTrustPolicy

func GenerateAwsTrustPolicy(clientAPI *client.APIClient, accountID string) (*client.AwsTrustPolicy, *http.Response, error)

GenerateAwsTrustPolicy aws trust policy

func GetAccountInstance

func GetAccountInstance(clientAPI *client.APIClient, accountID string) (*client.AwsAccountsInstance, *http.Response, error)

GetAccountInstance gets an aws account

func GetAwsAccountCollection

func GetAwsAccountCollection(clientAPI *client.APIClient, filter []basetypes.StringValue) (*client.AwsAccountsCollection200Response, *http.Response, error)

GetAwsAccountCollection gets list of block storage instances

func GetAwsPermssionCollection

func GetAwsPermssionCollection(clientAPI *client.APIClient, filter []basetypes.StringValue) (*client.AwsPermissionPoliciesCollection200Response, *http.Response, error)

GetAwsPermssionCollection gets list of block storage instances

func GetCloneCollection

func GetCloneCollection(client *client.APIClient, filter string) (*client.ClonesCollection200Response, *http.Response, error)

GetCloneCollection is a collection of clones

func GetCloneInstance

func GetCloneInstance(client *client.APIClient, id string) (*client.Clone, *http.Response, error)

GetCloneInstance is a clone

func GetClonesModel

func GetClonesModel(clone client.Clone, systemID string) (model models.ClonesModel)

GetClonesModel returns a new clonesModel based on data from the given clones

func GetClonesModelDs

func GetClonesModelDs(clone client.Clone) (model models.ClonesModelDs)

GetClonesModelDs returns a new clonesModelDs based on data from the given clones

func GetErrorMessageFromBody

func GetErrorMessageFromBody(ctx context.Context, body string) (string, error)

GetErrorMessageFromBody returns the error message from the response body

func GetErrorString

func GetErrorString(err error, status *http.Response) string

GetErrorString returns the error string from the response

func GetHostCollection

func GetHostCollection(client *client.APIClient, filter string) (*client.HostsCollection200Response, *http.Response, error)

GetHostCollection gets list of hosts.

func GetJobStatus

func GetJobStatus(ctx context.Context, jobsClient *jmsClient.APIClient, jobID string) (*jmsClient.JobsInstance, error)

GetJobStatus returns the job status

func GetMobilityGroup

func GetMobilityGroup(client *client.APIClient, id string) (*client.MobilityGroup, *http.Response, error)

GetMobilityGroup returns a single Mobility Group

func GetMobilityGroupCollection

func GetMobilityGroupCollection(client *client.APIClient, filter string) (*client.MobilityGroupsCollection200Response, *http.Response, error)

GetMobilityGroupCollection returns a list of all Mobility Groups

func GetMobilityGroupModel

func GetMobilityGroupModel(mobilityGroup client.MobilityGroup) (model models.MobilityGroupModel)

GetMobilityGroupModel returns a new mobilityGroupModel based on data from the given mobilityGroup

func GetMobilityGroupModelDs

func GetMobilityGroupModelDs(mobilityGroup client.MobilityGroup) (model models.MobilityGroupModelDs)

GetMobilityGroupModelDs returns a new mobilityGroupModel based on data from the given mobilityGroup

func GetMobilityTarget

func GetMobilityTarget(client *client.APIClient, id string) (*client.MobilityTarget, *http.Response, error)

GetMobilityTarget returns a single Mobility Target

func GetMobilityTargetCollection

func GetMobilityTargetCollection(client *client.APIClient, filter string) (*client.MobilityTargetsCollection200Response, *http.Response, error)

GetMobilityTargetCollection returns a list of all Mobility Targets

func GetMobilityTargetModel

func GetMobilityTargetModel(mobilityTarget client.MobilityTarget) (model models.MobilityTargetModel)

GetMobilityTargetModel creates a new MobilityTargetModel based on the provided mobilityTarget

func GetMobilityTargetModelDs

func GetMobilityTargetModelDs(mobilityTarget client.MobilityTarget) (model models.MobilityTargetModelDs)

GetMobilityTargetModelDs creates a new MobilityTargetModel based on the provided mobilityTarget

func GetNewToken

func GetNewToken(ctx context.Context) (string, error)

GetNewToken retrieves a new token by running a Python script, reading from a named pipe, and sending an API request.

ctx: The context.Context object for the function. Returns: - string: The token from the response from the API request. - error: An error if any occurred during the process.

func GetSourcePoolsCollection

func GetSourcePoolsCollection(client *client.APIClient, filter string) (*client.PoolsCollection200Response, *http.Response, error)

GetSourcePoolsCollection returns a list of all Source Pools

func GetStorageCollection

func GetStorageCollection(client *client.APIClient, filter string) (*client.StorageSystemsCollection200Response, *http.Response, error)

GetStorageCollection gets list of storage instances

func GetStorageInstance

func GetStorageInstance(client *client.APIClient, id string) (*client.StorageSystemsInstance, *http.Response, error)

GetStorageInstance gets storage instance

func GetStorageProductsCollection

func GetStorageProductsCollection(client *client.APIClient, filter string) (*client.StorageProductsCollection200Response, *http.Response, error)

GetStorageProductsCollection returns a list of all Stroage Products

func GetStorageSystemBlock

func GetStorageSystemBlock(storageSystem client.StorageSystemsInstance) (storageState models.StorageModel)

GetStorageSystemBlock returns a Block storage systems model based on the given storage system instance

func GetStorageSystemDs

func GetStorageSystemDs(storageSystem client.StorageSystemsInstance) (storageState models.StorageModelDs)

GetStorageSystemDs returns a storage systems model for datasource based on the given storage system instance

func GetStorageSystemFile

func GetStorageSystemFile(storageSystem client.StorageSystemsInstance) (storageState models.StorageModelFile)

GetStorageSystemFile returns a File storage systems model based on the given storage system instance

func GetVolumesCollection

func GetVolumesCollection(client *client.APIClient, filter string) (*client.VolumesCollection200Response, *http.Response, error)

GetVolumesCollection returns a list of all Volumes

func MapAwsAccount

MapAwsAccount maps the AWS account

func MapAwsPermission

MapAwsPermission maps the AWS permission policy

func MapClones

func MapClones(ctx context.Context, mapReq client.ApiClonesMapRequest, cloneID string, hosts []basetypes.StringValue) (*client.Job, *http.Response, error)

MapClones maps clones to a host

func MapGeneratedStatements

func MapGeneratedStatements(statements []client.AwsTrustPolicyStatementInner) basetypes.ListValue

MapGeneratedStatements maps the AWS permssions statements to terraform state

func MapHostModel

MapHostModel maps response body to model

func MapPoolsToState

func MapPoolsToState(pools []client.PoolsInstance) []models.PoolsModel

MapPoolsToState maps the pools to the terraform state

func MapStorageProduct

MapStorageProduct maps storage product to terraformsdk model

func MapVolumesToState

func MapVolumesToState(volumes []client.VolumesInstance) []models.VolumesModel

MapVolumesToState maps the given array of client.VolumesInstance to an array of models.VolumesModel.

func RefreshClone

func RefreshClone(refreshReq client.ApiClonesRefreshRequest) (*client.Job, *http.Response, error)

RefreshClone refreshes a clone

func SetCloudConfigSubnetAndVpcBlock

func SetCloudConfigSubnetAndVpcBlock(plan models.StorageModel, result models.StorageModel)

SetCloudConfigSubnetAndVpcBlock sets cloud config from plan

func SetCloudConfigSubnetAndVpcFile

func SetCloudConfigSubnetAndVpcFile(plan models.StorageModelFile, result models.StorageModelFile)

SetCloudConfigSubnetAndVpcFile sets cloud config from plan

func SetPowerflexAysncClientState

func SetPowerflexAysncClientState(source models.ActivationAsyncClientModel) *models.ActivationAsyncClientModel

SetPowerflexAysncClientState sets the powerflex client state

func SetPowerflexClientState

func SetPowerflexClientState(source models.ActivationClientModel) *models.ActivationClientModel

SetPowerflexClientState sets the powerflex client state

func UnmapClones

func UnmapClones(unmapReq client.ApiClonesUnmapRequest, hosts []basetypes.StringValue) (*client.Job, *http.Response, error)

UnmapClones unmaps clones from a host

func UpdateAccount

func UpdateAccount(clientAPI *client.APIClient, accountID string, roleArn string) (*client.Job, *http.Response, error)

UpdateAccount updates an aws account

func UpdateClone

UpdateClone sends the update clone request

func UpdateDeploymentDetails

func UpdateDeploymentDetails(planDeploymentDetail *models.DeploymentDetailsModel, resultDeploymentDetail *models.DeploymentDetailsModel)

UpdateDeploymentDetails sets the deplopyment details

func UpdateHostMappings

func UpdateHostMappings(clone *client.Clone) basetypes.ListValue

UpdateHostMappings updates the host mappings after map/unmap operations

func UpdateMobilityGroup

func UpdateMobilityGroup(ctx context.Context, clientAPI *client.APIClient, plan models.MobilityGroupModel) (*client.Job, *http.Response, error)

UpdateMobilityGroup updates an existing Mobility Group

func UpdateMobilityTarget

UpdateMobilityTarget sends the update mobility target request

func UpdateToken

func UpdateToken(ctx context.Context, client *apexClient.APIClient, jmsClient *jmsClient.APIClient) error

UpdateToken updates the token for the given API clients.

It takes a context.Context, a pointer to an apexClient.APIClient, and a pointer to a jmsClient.APIClient as parameters. It returns an error.

func ValidateCreateStorageParams

func ValidateCreateStorageParams(planDeploymentDetails *models.DeploymentDetailsModel) error

ValidateCreateStorageParams validates the parameters for the create function. It checks for any errors in the plan. If there are errors, it returns the error.

func ValidateCreateStorageParamsBlock

func ValidateCreateStorageParamsBlock(plan models.StorageModel) error

ValidateCreateStorageParamsBlock validates the parameters for the Block Storage create function.

func ValidateCreateStorageParamsFile

func ValidateCreateStorageParamsFile(plan models.StorageModelFile) error

ValidateCreateStorageParamsFile validates the parameters for the File Storage create function.

func WaitForJobToComplete

func WaitForJobToComplete(ctx context.Context, jobsClient *jmsClient.APIClient, jobID string) (string, error)

WaitForJobToComplete returns the job status and waits for the job to complete

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	IssuedTo     string `json:"issued_to"`
	TokenTypeURL string `json:"token_type_url"`
}

AccessTokenResponse represents the structure of the JSON response

type Config

type Config struct {
	ScriptPath    string
	DirPath       string
	TokenFileName string
	URLLink       string
	AccessKey     string
	Secret        string
}

Config represents the configuration settings for the token helper. The struct contains the following fields: - ScriptPath: the path to the script file that retrieves the token. - DirPath: the directory where the script file is located. - TokenFileName: the name of the file where the token is stored. - URLLink: the URL link for the API request. - AccessKey: the access key for the API request. - Secret: the secret key for the API request.

type Poller

type Poller interface {
	WaitForResource(ctx context.Context, id string) (string, error)
	CancelJob(ctx context.Context, id string) (*http.Response, error)
	GetJob(ctx context.Context, id string) (*jobsClient.JobsInstance, error)
}

Poller interface

func NewPoller

func NewPoller(jmsClient *jobsClient.APIClient) Poller

NewPoller returns a new poller object

Jump to

Keyboard shortcuts

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