administered

package
v0.0.0-...-8fb3fdf Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatasourceIdentitiesMeKey               = "identities_me"
	DatasourceIdentitiesMeAuthenticationKey = "authentication"
	DatasourceIdentitiesMeAPIKey            = "api"
	DatasourceIdentitiesMeSAMLKey           = "saml"
	DatasourceIdentitiesMeTwoFactorKey      = "two_factor"
)

Attribute key constants

Variables

View Source
var APIType = map[string]attr.Type{
	"key": types.ObjectType{AttrTypes: KeyType},
}

APIType defines the attribute types for APIModel.

View Source
var AuthenticationType = map[string]attr.Type{
	"mode":       types.StringType,
	"api":        types.ObjectType{AttrTypes: APIType},
	"saml":       types.ObjectType{AttrTypes: SAMLType},
	"two_factor": types.ObjectType{AttrTypes: TwoFactorType},
}

AuthenticationType defines the attribute types for AuthenticationModel.

View Source
var DataSourceType = map[string]attr.Type{
	"id":                     types.StringType,
	"name":                   types.StringType,
	"email":                  types.StringType,
	"last_used_dashboard_at": types.StringType,
	"authentication":         types.ObjectType{AttrTypes: AuthenticationType},
}

DataSourceType defines the attribute types for DataSourceModel.

View Source
var DatasourceAPIAttributes = schema.SingleNestedAttribute{
	MarkdownDescription: "API details for the user.",
	Computed:            true,
	Attributes: map[string]schema.Attribute{
		"key": schema.SingleNestedAttribute{
			MarkdownDescription: "API key details.",
			Computed:            true,
			Attributes: map[string]schema.Attribute{
				"created": schema.BoolAttribute{
					MarkdownDescription: "Whether the API key is created.",
					Computed:            true,
				},
			},
		},
	},
}

DatasourceAPIAttributes defines the schema for API details.

View Source
var DatasourceAuthenticationAttributes = schema.SingleNestedAttribute{
	MarkdownDescription: "Authentication details for the user.",
	Computed:            true,
	Attributes: map[string]schema.Attribute{
		"mode": schema.StringAttribute{
			MarkdownDescription: "The authentication mode.",
			Computed:            true,
		},
		"api":        DatasourceAPIAttributes,
		"saml":       DatasourceSAMLAttributes,
		"two_factor": DatasourceTwoFactorAttributes,
	},
}

DatasourceAuthenticationAttributes defines the schema for the authentication object.

View Source
var DatasourceSAMLAttributes = schema.SingleNestedAttribute{
	MarkdownDescription: "Details about SAML authentication.",
	Computed:            true,
	Attributes: map[string]schema.Attribute{
		"enabled": schema.BoolAttribute{
			MarkdownDescription: "Whether SAML authentication is enabled.",
			Computed:            true,
		},
	},
}

DatasourceSAMLAttributes defines the schema for SAML authentication.

View Source
var DatasourceTwoFactorAttributes = schema.SingleNestedAttribute{
	MarkdownDescription: "Details about two-factor authentication.",
	Computed:            true,
	Attributes: map[string]schema.Attribute{
		"enabled": schema.BoolAttribute{
			MarkdownDescription: "Whether two-factor authentication is enabled.",
			Computed:            true,
		},
	},
}

DatasourceTwoFactorAttributes defines the schema for two-factor authentication.

View Source
var GetDatasourceSchema = schema.Schema{
	MarkdownDescription: "Returns the identity of the current user.",

	Attributes: map[string]schema.Attribute{
		"id": schema.StringAttribute{
			MarkdownDescription: "Unique identifier for this data source. Always set to 'identities_me'.",
			Computed:            true,
		},
		"name": schema.StringAttribute{
			MarkdownDescription: "The name of the user.",
			Computed:            true,
		},
		"email": schema.StringAttribute{
			MarkdownDescription: "The email of the user.",
			Computed:            true,
		},
		"last_used_dashboard_at": schema.StringAttribute{
			MarkdownDescription: "The last time the user was active on the Dashboard UI.",
			Computed:            true,
		},
		"authentication": DatasourceAuthenticationAttributes,
	},
}

GetDatasourceSchema defines the schema for the current user's identity.

View Source
var KeyType = map[string]attr.Type{
	"created": types.BoolType,
}

KeyType defines the attribute types for KeyModel.

View Source
var SAMLType = map[string]attr.Type{
	"enabled": types.BoolType,
}

SAMLType defines the attribute types for SAMLModel.

View Source
var TwoFactorType = map[string]attr.Type{
	"enabled": types.BoolType,
}

TwoFactorType defines the attribute types for TwoFactorModel.

Functions

func MarshalAuthenticationAPIForRead

MarshalAuthenticationAPIForRead maps the API object from the Authentication section of the API response to Terraform state.

func MarshalAuthenticationAPIKeyForRead

MarshalAuthenticationAPIKeyForRead maps the API Key object to Terraform state.

func MarshalAuthenticationForRead

MarshalAuthenticationForRead maps the Authentication object from the API response to the Terraform state.

func MarshalAuthenticationSAMLForRead

MarshalAuthenticationSAMLForRead maps the SAML object from the Authentication section of the API response to Terraform state.

func MarshalAuthenticationTwoFactorForRead

MarshalAuthenticationTwoFactorForRead maps the TwoFactor object from the Authentication section of the API response to Terraform state.

func MarshalEmailForRead

func MarshalEmailForRead(ctx context.Context, inlineResp *client.GetAdministeredIdentitiesMe200Response) types.String

MarshalEmailForRead maps the Email field from the API response to the Terraform state.

func MarshalLastUsedDashboardAtForRead

func MarshalLastUsedDashboardAtForRead(ctx context.Context, inlineResp *client.GetAdministeredIdentitiesMe200Response) types.String

MarshalLastUsedDashboardAtForRead maps and validates the LastUsedDashboardAt field from the API response.

func MarshalNameForRead

func MarshalNameForRead(ctx context.Context, inlineResp *client.GetAdministeredIdentitiesMe200Response) types.String

MarshalNameForRead maps the Name field from the API response to the Terraform state.

func NewDataSource

func NewDataSource() datasource.DataSource

NewDataSource initializes a new Administered Identities Me data source.

Types

type APIModel

type APIModel struct {
	Key types.Object `tfsdk:"key" json:"key"`
}

APIModel represents API-related attributes.

type AuthenticationModel

type AuthenticationModel struct {
	Mode      types.String `tfsdk:"mode" json:"mode"`
	API       types.Object `tfsdk:"api" json:"api"`
	SAML      types.Object `tfsdk:"saml" json:"saml"`
	TwoFactor types.Object `tfsdk:"two_factor" json:"twoFactor"`
}

AuthenticationModel represents authentication attributes for a user.

type DataSource

type DataSource struct {
	// contains filtered or unexported fields
}

DataSource implements the Terraform data source for retrieving the current user's identity.

func (*DataSource) Configure

Configure initializes the API client for the data source.

func (*DataSource) Metadata

Metadata sets the data source type name.

func (*DataSource) Read

Read retrieves the current user's identity and populates the Terraform state.

func (*DataSource) Schema

Schema sets the data source schema.

type DataSourceModel

type DataSourceModel struct {
	Id                  types.String `tfsdk:"id" json:"-"`                                       // Unique identifier for the datasource.
	Name                types.String `tfsdk:"name" json:"name"`                                  // The user's name.
	Email               types.String `tfsdk:"email" json:"email"`                                // The user's email address.
	LastUsedDashboardAt types.String `tfsdk:"last_used_dashboard_at" json:"lastUsedDashboardAt"` // Last dashboard access time.
	Authentication      types.Object `tfsdk:"authentication" json:"authentication"`              // Authentication details.
}

DataSourceModel represents the main data model for identities.

func MarshalIdentitiesMeForRead

func MarshalIdentitiesMeForRead(ctx context.Context, inlineResp *client.GetAdministeredIdentitiesMe200Response) (DataSourceModel, diag.Diagnostics)

MarshalIdentitiesMeForRead maps the API response into the Terraform state model for the identities_me resource.

type KeyModel

type KeyModel struct {
	Created types.Bool `tfsdk:"created" json:"created"`
}

KeyModel represents the API key attributes.

type SAMLModel

type SAMLModel struct {
	Enabled types.Bool `tfsdk:"enabled" json:"enabled"`
}

SAMLModel represents SAML authentication attributes.

type TwoFactorModel

type TwoFactorModel struct {
	Enabled types.Bool `tfsdk:"enabled" json:"enabled"`
}

TwoFactorModel represents two-factor authentication attributes.

Jump to

Keyboard shortcuts

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