utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPointer

func BoolPointer(v bool) *bool

BoolPointer takes a bool 'v' as input and returns a pointer to that bool.

func BoolValue

func BoolValue(v *bool) bool

BoolValue takes a pointer to a bool 'v' as input and returns the bool value it points to. If the pointer is nil, it returns false.

func Float32Pointer

func Float32Pointer(v float32) *float32

Float32Pointer takes a float32 'v' as input and returns a pointer to that float32.

func Float32Value

func Float32Value(v *float32) float32

Float32Value takes a pointer to a float32 'v' as input and returns the float32 value it points to. If the pointer is nil, it returns 0.0.

func Float64Pointer

func Float64Pointer(v float64) *float64

Float64Pointer takes a float64 'v' as input and returns a pointer to that float64.

func Float64Value

func Float64Value(v *float64) float64

Float64Value takes a pointer to a float64 'v' as input and returns the float64 value it points to. If the pointer is nil, it returns 0.0.

func GetAllowedDurations

func GetAllowedDurations(allowed []client.EnumAllowedDurations) []attr.Value

func GetEmailString

func GetEmailString(email openapi_types.Email) (result string, err error)

GetEmailString is a function that extracts a string value from an openapi_types.Email. It marshals the email to JSON, trims any surrounding double quotes and escape characters, and returns the resulting string.

func GetStringList

func GetStringList(data *[]string) (types.List, diag.Diagnostics)

func IdParamsSchemaSlicePointer

func IdParamsSchemaSlicePointer(v []client.IdParamsSchema) *[]client.IdParamsSchema

func IdParamsSchemaSliceValue

func IdParamsSchemaSliceValue(v *[]client.IdParamsSchema) []client.IdParamsSchema

func Int32Pointer

func Int32Pointer(v int32) *int32

Int32Pointer takes an int32 'v' as input and returns a pointer to that int32.

func Int32Value

func Int32Value(v *int32) int32

Int32Value takes a pointer to an int32 'v' as input and returns the int32 value it points to. If the pointer is nil, it returns 0.

func Int64Pointer

func Int64Pointer(v int64) *int64

Int64Pointer takes an int64 'v' as input and returns a pointer to that int64.

func Int64Value

func Int64Value(v *int64) int64

Int64Value takes a pointer to an int64 'v' as input and returns the int64 value it points to. If the pointer is nil, it returns 0.

func IntPointer

func IntPointer(v int) *int

IntPointer takes an int 'v' as input and returns a pointer to that int.

func IntValue

func IntValue(v *int) int

IntValue takes a pointer to an int 'v' as input and returns the int value it points to. If the pointer is nil, it returns 0.

func StringPointer

func StringPointer(v string) *string

StringPointer takes a string 'v' as input and returns a pointer to that string.

func StringSlicePointer

func StringSlicePointer(v []string) *[]string

StringSlicePointer takes a string 'v' as input and returns a pointer to that string.

func StringSliceValue

func StringSliceValue(v *[]string) []string

StringSliceValue takes a pointer to a string 'v' as input and returns the string value it points to. If the pointer is nil, it returns an empty string.

func StringValue

func StringValue(v *string) string

StringValue takes a pointer to a string 'v' as input and returns the string value it points to. If the pointer is nil, it returns an empty string.

func TrimPrefixSuffix

func TrimPrefixSuffix(s string) string

TrimPrefixSuffix is a function that trims double quotes and escape characters from the beginning and end of a string. It returns the trimmed string.

func TrimmedStringValue added in v1.0.1

func TrimmedStringValue(s string) types.String

TrimmedStringValue is a function that trims double quotes and escape characters from the beginning and end of a string. It returns the trimmed hashicorp wrapped string.

func WorkflowRuleSchemaPointer

func WorkflowRuleSchemaPointer(v []client.WorkflowRuleSchema) *[]client.WorkflowRuleSchema

func WorkflowRuleSchemaValue

func WorkflowRuleSchemaValue(v *[]client.WorkflowRuleSchema) []client.WorkflowRuleSchema

Types

type ErrorBody

type ErrorBody struct {
	ID      string `json:"errorId"`
	Message string `json:"message"`
}

func GetErrorBody

func GetErrorBody(data []byte) (ErrorBody, error)

func (ErrorBody) GetMessage

func (e ErrorBody) GetMessage() string

type IdEmailModel

type IdEmailModel struct {
	// Id is the identifier attribute.
	Id types.String `tfsdk:"id"`

	// Email is the email address attribute.
	Email types.String `tfsdk:"email"`
}

IdEmailModel is a data model that represents a combination of an ID and an Email.

func (IdEmailModel) AsObjectValue

func (IdEmailModel) AttributeTypes

func (m IdEmailModel) AttributeTypes() map[string]attr.Type

type IdNameEmailModel

type IdNameEmailModel struct {
	// Id is the identifier attribute.
	Id types.String `tfsdk:"id"`

	// Name is the name attribute.
	Name types.String `tfsdk:"name"`

	// Email is the email address attribute.
	Email types.String `tfsdk:"email"`
}

IdNameEmailModel is a data model that represents an ID, a Name, and an Email.

func (IdNameEmailModel) AsObjectValue

func (IdNameEmailModel) AttributeTypes

func (m IdNameEmailModel) AttributeTypes() map[string]attr.Type

type IdNameModel

type IdNameModel struct {
	// ID is the identifier attribute.
	ID types.String `tfsdk:"id"`

	// Name is the name attribute.
	Name types.String `tfsdk:"name"`
}

IdNameModel is a data model that represents an ID and a Name.

func (IdNameModel) AsObjectValue

func (IdNameModel) AttributeTypes

func (m IdNameModel) AttributeTypes() map[string]attr.Type

type IdentityOnlyModel

type IdentityOnlyModel struct {
	// Id is the identifier attribute.
	Id types.String `tfsdk:"id"`
}

IdentityOnlyModel is a data model that represents only an ID.

func (IdentityOnlyModel) AsObjectValue

func (IdentityOnlyModel) AttributeTypes

func (m IdentityOnlyModel) AttributeTypes() map[string]attr.Type

type MaintainerCommonResponseSchema

type MaintainerCommonResponseSchema struct {
	Type  string                      `json:"type"`
	Group client.EntityResponseSchema `json:"group"`
	User  client.EntityResponseSchema `json:"user"`
}

MaintainerCommonResponseSchema represents the common structure of a maintainer response in the integration and resource.

type MaintainerInterface

type MaintainerInterface interface {
	AsMaintainerUserResponseSchema() (client.MaintainerUserResponseSchema, error)
	AsMaintainerGroupResponseSchema() (client.MaintainerGroupResponseSchema, error)
	MarshalJSON() ([]byte, error)
}

type MaintainerModel

type MaintainerModel struct {
	Type   types.String `tfsdk:"type"`
	Entity types.Object `tfsdk:"entity"`
}

MaintainerModel describes the data source data model.

func GetMaintainers

func GetMaintainers[T MaintainerInterface](
	ctx context.Context,
	maintainers []T,
) ([]*MaintainerModel, diag.Diagnostics)

func (MaintainerModel) AttributeTypes

func (m MaintainerModel) AttributeTypes() map[string]attr.Type

attributeTypes returns the attribute types for MaintainerModel.

type NameModel

type NameModel struct {
	// Name is the name attribute.
	Name types.String `tfsdk:"name"`
}

NameModel is a data model that represents only a Name.

func (NameModel) AsObjectValue

func (m NameModel) AsObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics)

func (NameModel) AttributeTypes

func (m NameModel) AttributeTypes() map[string]attr.Type

type Role

type Role struct {
	ID       types.String `tfsdk:"id" json:"id"`
	Name     types.String `tfsdk:"name" json:"name"`
	Resource types.Object `tfsdk:"resource" json:"resource"`
}

Role represents the internal representation of Role Model.

func GetRole

func GetRole(
	ctx context.Context,
	id, name string,
	resource interface{},
) (*Role, diag.Diagnostics)

func (Role) AttributeTypes

func (m Role) AttributeTypes() map[string]attr.Type

attributeTypes returns the attribute types for Role.

type RoleResource

type RoleResource struct {
	Id          types.String            `tfsdk:"id" json:"id"`
	Name        types.String            `tfsdk:"name" json:"name"`
	Integration RoleResourceIntegration `tfsdk:"integration" json:"integration"`
}

RoleResource represents the Terraform resource model for the Role resource.

func (RoleResource) AsObjectValue

AsObjectValue converts RoleResourceModel to ObjectValue.

type RoleResourceIntegration

type RoleResourceIntegration struct {
	Id          types.String `tfsdk:"id" json:"id"`
	Name        types.String `tfsdk:"name" json:"name"`
	Application NameModel    `tfsdk:"application" json:"application"`
}

RoleResourceIntegration represents the Terraform resource model for the integration part of Role resource.

func (RoleResourceIntegration) AsObjectValue

AsObjectValue converts RoleResourceIntegration to ObjectValue.

type RoleResourceIntegrationApplication

type RoleResourceIntegrationApplication struct {
	Name types.String `tfsdk:"name" json:"name"`
}

RoleResourceIntegrationApplication represents the Terraform resource model for the application part of Role resource.

func (RoleResourceIntegrationApplication) AsObjectValue

AsObjectValue converts RoleResourceIntegrationApplication to ObjectValue.

func (RoleResourceIntegrationApplication) AttributeTypes

func (m RoleResourceIntegrationApplication) AttributeTypes() map[string]attr.Type

attributeTypes returns the attribute types for RoleResourceIntegrationApplicationModel.

type RoleResourceIntegrationModel

type RoleResourceIntegrationModel struct {
	ID          types.String `tfsdk:"id" json:"id"`
	Name        types.String `tfsdk:"name" json:"name"`
	Application types.Object `tfsdk:"application" json:"application"`
}

RoleResourceIntegrationModel represents the internal representation of RoleResourceIntegration.

func (RoleResourceIntegrationModel) AttributeTypes

func (m RoleResourceIntegrationModel) AttributeTypes() map[string]attr.Type

AttributeTypes returns the attribute types for RoleResourceIntegrationModel.

type RoleResourceModel

type RoleResourceModel struct {
	ID          types.String `tfsdk:"id" json:"id"`
	Name        types.String `tfsdk:"name" json:"name"`
	Integration types.Object `tfsdk:"integration" json:"integration"`
}

RoleResourceModel represents the internal representation of RoleResourceModel.

func (RoleResourceModel) AttributeTypes

func (m RoleResourceModel) AttributeTypes() map[string]attr.Type

AttributeTypes returns the attribute types for RoleResourceModel.

Jump to

Keyboard shortcuts

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