common

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2024. Clumio, Inc.

Index

Constants

View Source
const (
	ClumioApiToken                  = "CLUMIO_API_TOKEN"
	ClumioApiBaseUrl                = "CLUMIO_API_BASE_URL"
	ClumioOrganizationalUnitContext = "CLUMIO_ORGANIZATIONAL_UNIT_CONTEXT"
	AwsRegion                       = "AWS_REGION"
	ClumioTestAwsAccountId          = "CLUMIO_TEST_AWS_ACCOUNT_ID"
	ClumioTestAwsAccountId2         = "CLUMIO_TEST_AWS_ACCOUNT_ID2"
	ClumioTestIsSSOConfigured       = "CLUMIO_TEST_IS_SSO_CONFIGURED"

	TaskSuccess = "completed"
	TaskAborted = "aborted"
	TaskFailed  = "failed"

	// AWS Manual Connection Resources
	ClumioIAMRoleArn         = "clumio_iam_role_arn"
	ClumioEventPubArn        = "clumio_event_pub_arn"
	ClumioSupportRoleArn     = "clumio_support_role_arn"
	CloudwatchRuleArn        = "cloudwatch_rule_arn"
	CloudtrailRuleArn        = "cloudtrail_rule_arn"
	ContinuousBackupsRoleArn = "continuous_backups_role_arn"
	SsmNotificationRoleArn   = "ssm_notification_role_arn"
	Ec2SsmInstanceProfileArn = "ec2_ssm_instance_profile_arn"

	// Default Error Message
	NilErrorMessageSummary = "Unexpected API response"
	NilErrorMessageDetail  = "An empty response was returned by the API"

	// Testing error format
	TestResultsNotMatchingError = "Results don't match.\nExpected: %v\nActual: %v"

	// Auth Error
	AuthError = "Unauthorized access. Please ensure that your credentials are valid and/or your account is active."
)

Variables

This section is empty.

Functions

func DeletePolicy added in v0.6.0

func DeletePolicy(idOrResourceName string, isResourceName bool) resource.TestCheckFunc

DeletePolicy deletes the policy using the Clumio API. It takes as argument, either the resource name or the actual id of the policy.

func DeleteProtectionGroup added in v0.6.0

func DeleteProtectionGroup(idOrResourceName string, isResourceName bool) resource.TestCheckFunc

DeleteProtectionGroup deletes the protection group using the Clumio API. It takes as argument, either the resource name or the actual id of the policy.

func GetFieldNameFromNestedBlockPath added in v0.6.0

func GetFieldNameFromNestedBlockPath(req validator.SetRequest) string

Parses through the path of a nested block and returns the lowest level field name

func GetSDKConfigForOU added in v0.6.1

func GetSDKConfigForOU(clumioConfig sdkconfig.Config, organizationalUnitId string) sdkconfig.Config

GetSDKConfigForOU returns a copy of the given SDK config with the OrganizationalUnitContext set to the specified organizationalUnitId.

func GetStringPtr added in v0.5.3

func GetStringPtr(v basetypes.StringValue) *string

GetStringPtr returns the ptr of the string if not null, otherwise return nil.

func GetStringPtrSliceFromStringSlice added in v0.5.1

func GetStringPtrSliceFromStringSlice(input []string) []*string

GetStringPtrSliceFromStringSlice returns the string pointer slice from string slice.

func ParseMessageFromApiError added in v0.6.0

func ParseMessageFromApiError(apiError *apiutils.APIError) string

Parses the api error and returns the response in stringified format

func PollForProtectionGroup added in v0.6.1

func PollForProtectionGroup(
	ctx context.Context, id string, protectionGroup sdkclients.ProtectionGroupClient,
	timeout time.Duration, interval time.Duration) (*models.ReadProtectionGroupResponse, error)

PollForProtectionGroup polls till the protection group becomes available after create or update protection group as they are asynchronous operations.

func PollTask

func PollTask(ctx context.Context, taskClient tasks.TasksV1Client,
	taskId string, timeout time.Duration, interval time.Duration) error

PollTask polls created tasks till it completes either with success, aborted, failed or it returns an error.

func SliceDifferenceString added in v0.5.1

func SliceDifferenceString(slice1 []string, slice2 []string) []string

SliceDifferenceString returns the slice difference in string slices.

func SnakeCaseToCamelCase

func SnakeCaseToCamelCase(key string) string

function to convert string in snake case to camel case

func WrapSetValidator added in v0.6.0

func WrapSetValidator(validator validator.Set) validator.Set

Function wrapper around the validator

Types

type ApiClient

type ApiClient struct {
	ClumioConfig clumioConfig.Config
}

ApiClient defines the APIs/connections required by the resources.

type WrapperSetValidator added in v0.6.0

type WrapperSetValidator struct {
	validator.Set
}

WrapperSetValidator acts as a wrapper and validates the input against the provider validator. If there's an error it returns the provided custom error message.

func (WrapperSetValidator) ValidateSet added in v0.6.0

ValidateSet runs validation logic on the provided request and adds diagnostics as required to the response

Jump to

Keyboard shortcuts

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