Documentation
¶
Index ¶
- func ClaimDeviceConfig(serial string) string
- func ClaimDeviceTestChecks(serial string) resource.TestCheckFunc
- func ClaimLicenseConfig(license string) string
- func ClaimLicenseTestChecks(license string) resource.TestCheckFunc
- func ClaimOrderConfig(order string) string
- func ClaimOrderTestChecks(order string) resource.TestCheckFunc
- func ConvertResourceSchemaToDataSourceSchema(resourceAttrs map[string]schema.Attribute) map[string]datasourceSchema.Attribute
- func CreateNetworkConfig(orgName, networkName string) string
- func CreateNetworkOrgIdConfig(orgId, networkName string) string
- func CreateOrganizationConfig(organizationName string) string
- func CreateResourceConfig(resourceType string, attributes map[string]string) string
- func CustomHttpRequestRetry[T any](ctx context.Context, maxRetries int, initialRetryDelay time.Duration, ...) (T, *http.Response, error)
- func CustomHttpRequestRetryStronglyTyped[T any](ctx context.Context, maxRetries int, retryDelay time.Duration, ...) (T, *http.Response, error, diag.Diagnostics)
- func Decrypt(key, cryptoText string) (string, error)
- func Encrypt(key, text string) (string, error)
- func ExtractBoolAttr(hashMap map[string]interface{}, key string) (types.Bool, diag.Diagnostics)
- func ExtractFloat32Attr(hashMap map[string]interface{}, key string) (types.Float64, diag.Diagnostics)
- func ExtractFloat64Attr(hashMap map[string]interface{}, key string) (types.Float64, diag.Diagnostics)
- func ExtractInt32Attr(hashMap map[string]interface{}, key string) (types.Int64, diag.Diagnostics)
- func ExtractInt64Attr(hashMap map[string]interface{}, key string) (types.Int64, diag.Diagnostics)
- func ExtractInt64FromFloat(hashMap map[string]interface{}, key string) (types.Int64, diag.Diagnostics)
- func ExtractListAttr(hashMap map[string]interface{}, key string, elemType attr.Type) (types.List, diag.Diagnostics)
- func ExtractListStringAttr(hashMap map[string]interface{}, key string) (types.List, diag.Diagnostics)
- func ExtractObjectAttr(hashMap map[string]interface{}, key string, attrTypes map[string]attr.Type) (types.Object, diag.Diagnostics)
- func ExtractResponseToMap(resp *http.Response) (map[string]interface{}, error)
- func ExtractStringAttr(hashMap map[string]interface{}, key string) (types.String, diag.Diagnostics)
- func ExtractStringsFromList(array types.List) ([]string, diag.Diagnostics)
- func FlattenList(input types.List) []string
- func Float32Pointer(input float64) (*float32, diag.Diagnostics)
- func Float64Pointer(input float32) (*float64, diag.Diagnostics)
- func GenerateTimestamp() string
- func HandleAPIError(ctx context.Context, resp *http.Response, err error, diags *diag.Diagnostics) error
- func HttpDiagnostics(httpResp *http.Response) string
- func Int32Pointer(input int64) (*int32, diag.Diagnostics)
- func ListInt64TypeToInt32Array(data types.List) ([]int32, diag.Diagnostics)
- func LogCurrentState(t *testing.T) resource.TestCheckFunc
- func LogPayload(ctx context.Context, payload interface{})
- func LogResponseBody(ctx context.Context, httpResp *http.Response)
- func NetworkOrgIdTestChecks(networkName string) resource.TestCheckFunc
- func NetworkTestChecks(networkName string) resource.TestCheckFunc
- func NewBoolDefault(defaultValue bool) defaults.Bool
- func NewFloat64Default(defaultValue float64) defaults.Float64
- func NewHttpDiagnostics(httpResp *http.Response, bodyContent string) string
- func NewInt64Default(defaultValue int64) defaults.Int64
- func NewSensitivePlanModifier(encryptionKey string) planmodifier.String
- func NewStringDefault(defaultValue string) defaults.String
- func OrganizationTestChecks(organizationName string) resource.TestCheckFunc
- func ReadAndCloseBody(httpResp *http.Response) (string, error)
- func ResourceTestCheck(resourceName string, expectedAttrs map[string]string) resource.TestCheckFunc
- func SafeBoolAttr(data map[string]interface{}, key string) attr.Value
- func SafeFormatRFC3339(ctx context.Context, t *time.Time, layout string) string
- func SafeInt64Attr(data map[string]interface{}, key string) attr.Value
- func SafeListStringAttr(data map[string]interface{}, key string) attr.Value
- func SafeStringAttr(data map[string]interface{}, key string) attr.Value
- func ValidateRFC3339(value string) error
- type RequiresReplaceIfSensitive
- type SensitivePlanModifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaimDeviceConfig ¶
ClaimDeviceConfig returns a configuration string to claim a device by serial
func ClaimDeviceTestChecks ¶
func ClaimDeviceTestChecks(serial string) resource.TestCheckFunc
ClaimDeviceTestChecks returns the test check functions for claiming a device by serial
func ClaimLicenseConfig ¶
ClaimLicenseConfig returns a configuration string to claim a license
func ClaimLicenseTestChecks ¶
func ClaimLicenseTestChecks(license string) resource.TestCheckFunc
ClaimLicenseTestChecks returns the test check functions for claiming a license
func ClaimOrderConfig ¶
ClaimOrderConfig returns a configuration string to claim an order
func ClaimOrderTestChecks ¶
func ClaimOrderTestChecks(order string) resource.TestCheckFunc
ClaimOrderTestChecks returns the test check functions for claiming an order
func ConvertResourceSchemaToDataSourceSchema ¶
func ConvertResourceSchemaToDataSourceSchema(resourceAttrs map[string]schema.Attribute) map[string]datasourceSchema.Attribute
ConvertResourceSchemaToDataSourceSchema converts a resource schema to a data source schema while carrying over all settings.
func CreateNetworkConfig ¶
CreateNetworkConfig returns a configuration string to create a network resource with the necessary test checks
func CreateNetworkOrgIdConfig ¶
CreateNetworkOrgIdConfig returns a configuration string to create a network in an existing organization with the necessary test checks
func CreateOrganizationConfig ¶
CreateOrganizationConfig returns a configuration string to create an organization resource
func CreateResourceConfig ¶
CreateResourceConfig returns a configuration string to create any resource
func CustomHttpRequestRetry ¶
func CustomHttpRequestRetry[T any](ctx context.Context, maxRetries int, initialRetryDelay time.Duration, apiCall func() (T, *http.Response, error)) (T, *http.Response, error)
CustomHttpRequestRetry Helper function for retrying API calls. This is to recover from backend congestion errors which manifest as 4XX response codes
func CustomHttpRequestRetryStronglyTyped ¶
func CustomHttpRequestRetryStronglyTyped[T any](ctx context.Context, maxRetries int, retryDelay time.Duration, apiCall func() (T, *http.Response, error, diag.Diagnostics)) (T, *http.Response, error, diag.Diagnostics)
CustomHttpRequestRetryStronglyTyped is a generic function that leverages CustomHttpRequestRetry
func ExtractBoolAttr ¶
ExtractBoolAttr Extracts a bool attribute from a hashmap
func ExtractFloat32Attr ¶
func ExtractFloat32Attr(hashMap map[string]interface{}, key string) (types.Float64, diag.Diagnostics)
ExtractFloat32Attr Extracts a float attribute from a hashmap
func ExtractFloat64Attr ¶
func ExtractFloat64Attr(hashMap map[string]interface{}, key string) (types.Float64, diag.Diagnostics)
ExtractFloat64Attr Extracts a float attribute from a hashmap
func ExtractInt32Attr ¶
ExtractInt32Attr Extracts an int64 attribute from a hashmap
func ExtractInt64Attr ¶
ExtractInt64Attr Extracts an int64 attribute from a hashmap
func ExtractInt64FromFloat ¶
func ExtractListAttr ¶
func ExtractListAttr(hashMap map[string]interface{}, key string, elemType attr.Type) (types.List, diag.Diagnostics)
ExtractListAttr extracts a list attribute from a hashmap
func ExtractListStringAttr ¶
func ExtractListStringAttr(hashMap map[string]interface{}, key string) (types.List, diag.Diagnostics)
ExtractListStringAttr extracts a slice of string attributes from a hashmap
func ExtractObjectAttr ¶
func ExtractObjectAttr(hashMap map[string]interface{}, key string, attrTypes map[string]attr.Type) (types.Object, diag.Diagnostics)
ExtractObjectAttr extracts an object attribute from a hashmap
func ExtractResponseToMap ¶
ExtractResponseToMap reads an HTTP response body and unmarshals the JSON content into a map[string]interface{}. It returns the map along with any error that occurs during the read or unmarshal process.
func ExtractStringAttr ¶
ExtractStringAttr Extracts a string attribute from a hashmap
func ExtractStringsFromList ¶
func ExtractStringsFromList(array types.List) ([]string, diag.Diagnostics)
func FlattenList ¶
FlattenList converts a Terraform types.List into a slice of strings.
func Float32Pointer ¶
func Float32Pointer(input float64) (*float32, diag.Diagnostics)
Float32Pointer Convert float64 to *float32 with error handling
func Float64Pointer ¶
func Float64Pointer(input float32) (*float64, diag.Diagnostics)
Float64Pointer Convert float32 to *float64 with error handling
func GenerateTimestamp ¶
func GenerateTimestamp() string
GenerateTimestamp returns the current timestamp in the format YYYYMMDDHHMMSS
func HandleAPIError ¶
func HandleAPIError(ctx context.Context, resp *http.Response, err error, diags *diag.Diagnostics) error
HandleAPIError processes API errors and maps them to Terraform diagnostics.
func HttpDiagnostics ¶
HttpDiagnostics - responsible for gathering and logging HTTP driven events
func Int32Pointer ¶
func Int32Pointer(input int64) (*int32, diag.Diagnostics)
Int32Pointer Convert int64 to *int32 with error handling
func ListInt64TypeToInt32Array ¶
func ListInt64TypeToInt32Array(data types.List) ([]int32, diag.Diagnostics)
func LogCurrentState ¶
func LogCurrentState(t *testing.T) resource.TestCheckFunc
LogCurrentState LogCurrentStat Custom test check function to log the current state
func LogPayload ¶
LogPayload logs the request payload before making an API call.
func LogResponseBody ¶
LogResponseBody logs the raw response body from the API.
func NetworkOrgIdTestChecks ¶
func NetworkOrgIdTestChecks(networkName string) resource.TestCheckFunc
NetworkOrgIdTestChecks returns the aggregated test check functions for a network resource that is in an existing org
func NetworkTestChecks ¶
func NetworkTestChecks(networkName string) resource.TestCheckFunc
NetworkTestChecks returns the aggregated test check functions for a network resource
func NewBoolDefault ¶
NewBoolDefault returns a struct that implements the defaults.Bool interface for a resource Schema
func NewFloat64Default ¶
NewFloat64Default returns a struct that implements the defaults.Float64 interface for a resource Schema
func NewHttpDiagnostics ¶
NewHttpDiagnostics - responsible for gathering and logging HTTP driven events
func NewInt64Default ¶
NewInt64Default returns a struct that implements the defaults.Int64 interface for a resource Schema
func NewSensitivePlanModifier ¶
func NewSensitivePlanModifier(encryptionKey string) planmodifier.String
func NewStringDefault ¶
NewStringDefault returns a struct that implements the defaults.String interface for a resource Schema
func OrganizationTestChecks ¶
func OrganizationTestChecks(organizationName string) resource.TestCheckFunc
OrganizationTestChecks returns the aggregated test check functions for an Organization resource
func ReadAndCloseBody ¶
ReadAndCloseBody Define a helper function to read and close the HTTP response body
func ResourceTestCheck ¶
func ResourceTestCheck(resourceName string, expectedAttrs map[string]string) resource.TestCheckFunc
ResourceTestCheck is a generic function to test any resource's attributes
func SafeBoolAttr ¶
SafeBoolAttr safely maps a boolean field
func SafeFormatRFC3339 ¶
SafeFormatRFC3339 safely formats a *time.Time to a string using the provided layout. Returns an empty string if the time pointer is nil.
func SafeInt64Attr ¶
SafeInt64Attr safely maps an integer field
func SafeListStringAttr ¶
SafeListStringAttr safely maps a list of strings
func SafeStringAttr ¶
SafeStringAttr safely maps a string field
func ValidateRFC3339 ¶
ValidateRFC3339 validates whether a given string conforms to the RFC3339 format. Returns an error if the format is invalid.
Types ¶
type RequiresReplaceIfSensitive ¶
type RequiresReplaceIfSensitive struct{}
RequiresReplaceIfSensitive Custom plan modifier to require replacement if the sensitive attribute changes
func (RequiresReplaceIfSensitive) Description ¶
func (r RequiresReplaceIfSensitive) Description(context.Context) string
func (RequiresReplaceIfSensitive) MarkdownDescription ¶
func (r RequiresReplaceIfSensitive) MarkdownDescription(context.Context) string
func (RequiresReplaceIfSensitive) PlanModifyString ¶
func (r RequiresReplaceIfSensitive) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse)
type SensitivePlanModifier ¶
type SensitivePlanModifier struct {
// contains filtered or unexported fields
}
func (SensitivePlanModifier) Description ¶
func (m SensitivePlanModifier) Description(ctx context.Context) string
func (SensitivePlanModifier) MarkdownDescription ¶
func (m SensitivePlanModifier) MarkdownDescription(ctx context.Context) string
func (SensitivePlanModifier) PlanModifyString ¶
func (m SensitivePlanModifier) PlanModifyString(ctx context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse)