model

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEY_SET_ID_PREFIX = "B2C_1A_"
)

Variables

View Source
var (
	KeySetIdValidator = stringvalidator.RegexMatches(
		regexp.MustCompile(`^B2C_1A_[a-zA-Z]+$`), "must be prefixed with B2C_1A_ and must contain only alphanumeric characters",
	)

	KeySetNameValidator = stringvalidator.RegexMatches(
		regexp.MustCompile(`^[a-zA-Z]+$`), "must contain only alphanumeric characters",
	)
)
View Source
var (
	KeySetDataSourceSchema = schema.Schema{
		MarkdownDescription: "Use this data source to access information about an existing key or certificate. Please see [Azure AD B2C Policy Keys](https://learn.microsoft.com/en-us/azure/active-directory-b2c/policy-keys-overview?pivots=b2c-custom-policy) for details.",

		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				MarkdownDescription: "The id of the keyset",
				Optional:            true,
				Computed:            true,
				Validators: []validator.String{
					stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("name")),
					KeySetIdValidator,
				},
			},
			"name": schema.StringAttribute{
				MarkdownDescription: "The name of the keyset",
				Optional:            true,
				Computed:            true,
				Validators: []validator.String{
					stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("id")),
					KeySetNameValidator,
				},
			},
			"keys": schema.ListNestedAttribute{
				MarkdownDescription: "Represents a list of JWK (JSON Web Key). TrustFrameworkKey is a JSON data structure that represents a cryptographic key. The structure of this resource follows the format defined in RFC 7517 Section 4.",
				Computed:            true,
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"kid": schema.StringAttribute{
							MarkdownDescription: "The unique identifier for the key.",
							Computed:            true,
						},
						"use": schema.StringAttribute{
							MarkdownDescription: "The use (public key use) parameter identifies the intended use of the public key. The use parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Possible values are: sig (signature), enc (encryption)",
							Computed:            true,
						},
						"kty": schema.StringAttribute{
							MarkdownDescription: "The kty (key type) parameter identifies the cryptographic algorithm family used with the key, The valid values are rsa, oct.",
							Computed:            true,
						},
						"n": schema.StringAttribute{
							MarkdownDescription: "RSA Key - modulus",
							Computed:            true,
							Sensitive:           true,
						},
						"e": schema.StringAttribute{
							MarkdownDescription: "RSA Key - public exponent",
							Computed:            true,
							Sensitive:           true,
						},
						"exp": schema.Int64Attribute{
							MarkdownDescription: "This value is a NumericDate as defined in RFC 7519 (A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds.)",
							Computed:            true,
							Sensitive:           true,
						},
						"x5c": schema.ListAttribute{
							ElementType:         types.StringType,
							MarkdownDescription: "The x5c (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates RFC 5280.",
							Computed:            true,
							Sensitive:           true,
						},
						"x5t": schema.StringAttribute{
							MarkdownDescription: "The x5t (X.509 certificate SHA-1 thumbprint) parameter is a base64url-encoded SHA-1 thumbprint (also known as digest) of the DER encoding of an X.509 certificate RFC 5280.",
							Computed:            true,
							Sensitive:           true,
						},
						"nbf": schema.Int64Attribute{
							MarkdownDescription: "This value is a NumericDate as defined in RFC 7519 (A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds.)",
							Computed:            true,
							Sensitive:           true,
						},
					},
				},
			},
		},
	}
)
View Source
var (
	KeySetResourceSchema = schema.SingleNestedAttribute{
		MarkdownDescription: "Key set data",
		Optional:            true,
		Computed:            true,
		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				MarkdownDescription: "The id of the keyset",
				Optional:            true,
				Computed:            true,
				Validators: []validator.String{
					stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("name")),
					KeySetIdValidator,
				},
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.RequiresReplace(),
				},
			},
			"name": schema.StringAttribute{
				MarkdownDescription: "The name of the keyset",
				Optional:            true,
				Computed:            true,
				Validators: []validator.String{
					stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("id")),
					KeySetNameValidator,
				},
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.RequiresReplace(),
				},
			},
			"keys": schema.ListNestedAttribute{
				MarkdownDescription: "Represents a list of JWK (JSON Web Key). TrustFrameworkKey is a JSON data structure that represents a cryptographic key. The structure of this resource follows the format defined in RFC 7517 Section 4.",
				Computed:            true,
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"kid": schema.StringAttribute{
							MarkdownDescription: "The unique identifier for the key.",
							Computed:            true,
						},
						"kty": schema.StringAttribute{
							MarkdownDescription: "The kty (key type) parameter identifies the cryptographic algorithm family used with the key, The valid values are rsa, oct.",
							Computed:            true,
						},
						"use": schema.StringAttribute{
							MarkdownDescription: "The use (public key use) parameter identifies the intended use of the public key. The use parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Possible values are: sig (signature), enc (encryption)",
							Computed:            true,
						},
						"n": schema.StringAttribute{
							MarkdownDescription: "RSA Key - modulus",
							Computed:            true,
							Sensitive:           true,
						},
						"e": schema.StringAttribute{
							MarkdownDescription: "RSA Key - public exponent",
							Computed:            true,
							Sensitive:           true,
						},
						"exp": schema.Int64Attribute{
							MarkdownDescription: "This value is a NumericDate as defined in RFC 7519 (A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds.)",
							Computed:            true,
							Sensitive:           true,
						},
						"nbf": schema.Int64Attribute{
							MarkdownDescription: "This value is a NumericDate as defined in RFC 7519 (A JSON numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds.)",
							Computed:            true,
							Sensitive:           true,
						},
						"x5c": schema.ListAttribute{
							ElementType:         types.StringType,
							MarkdownDescription: "The x5c (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates RFC 5280.",
							Computed:            true,
							Sensitive:           true,
						},
						"x5t": schema.StringAttribute{
							MarkdownDescription: "The x5t (X.509 certificate SHA-1 thumbprint) parameter is a base64url-encoded SHA-1 thumbprint (also known as digest) of the DER encoding of an X.509 certificate RFC 5280.",
							Computed:            true,
							Sensitive:           true,
						},
					},
				},
			},
		},
	}
)

Functions

This section is empty.

Types

type ApplicationPatch

type ApplicationPatch struct {
	ObjectId        types.String `tfsdk:"object_id"`
	SamlMetadataUrl types.String `tfsdk:"saml_metadata_url"`
	PatchFile       types.String `tfsdk:"patch_file"`
	Data            types.Object `tfsdk:"data"`
}

ApplicationPatch represents a patch for an application.

func (*ApplicationPatch) Consume

func (*ApplicationPatch) GetPatch

func (a *ApplicationPatch) GetPatch() (map[string]interface{}, diag.Diagnostics)

GetPatch retrieves the patch data from the ApplicationPatch instance. It reads the patch file specified in the PatchFile field, parses it as JSON, and returns the patch data as a map[string]interface{}. If the patch File is empty, it returns nil. If there are any errors during reading the patch file, parsing JSON, or the SamlMetadataUrl field is not empty, an error will be added to the diag.Diagnostics and returned along with nil patch data.

type KeySet

type KeySet struct {
	Id   types.String `tfsdk:"id"`
	Name types.String `tfsdk:"name"`
	Keys types.List   `tfsdk:"keys"`
}

KeySet struct defines the structure of a key set.

func (*KeySet) Consume

Consume consumes a TrustFrameworkKeySetable and updates the KeySet object with the corresponding values.

func (*KeySet) GetId

func (ks *KeySet) GetId() string

GetId returns the value of the Id field if it is not null or unknown. Otherwise, the value of the Name field, prefixed with KEY_SET_ID_PREFIX is returned.

func (*KeySet) GetNameOrId

func (ks *KeySet) GetNameOrId() string

GetNameOrId returns the name of the KeySet if the Id field is null or unknown. Otherwise, it returns the value of the Id field.

func (*KeySet) GetObjectValue

GetObjectValue builds the value for the KeySetKey.KeySet and KeySetCertificate.KeySet fields.

type KeySetCertificate

type KeySetCertificate struct {
	KeySet      types.Object `tfsdk:"key_set"`
	Certificate types.String `tfsdk:"certificate"`
	Password    types.String `tfsdk:"password"`
}

KeySetCertificate represents a type that holds information about a certificate associated with a key set.

type KeySetKey

type KeySetKey struct {
	KeySet types.Object `tfsdk:"key_set"`
	Use    types.String `tfsdk:"use"`
	Type   types.String `tfsdk:"type"`
	Secret types.String `tfsdk:"secret"`
}

KeySetKey represents a key associated with a key set. It contains the following fields: - KeySet: the key set to which the key belongs (tfsdk:"key_set"). - Use: the intended use of the key (tfsdk:"use"). - Type: the type of the key (tfsdk:"type").

func (*KeySetKey) Consume added in v0.3.0

type KeySetKeys

type KeySetKeys struct {
	E   types.String `tfsdk:"e"`
	Exp types.Number `tfsdk:"exp"`
	Kid types.String `tfsdk:"kid"`
	Kty types.String `tfsdk:"kty"`
	N   types.String `tfsdk:"n"`
	Nbf types.Number `tfsdk:"nbf"`
	X5c types.List   `tfsdk:"x5c"`
	X5t types.String `tfsdk:"x5t"`
	Use types.String `tfsdk:"use"`
}

KeySetKeys struct defines the structure of a key set's keys, including the attributes: E, Exp, Kid, Kty, N, Nbf, X5c, X5t, and Use.

type OrganizationalBrandingLocalization added in v0.4.0

type OrganizationalBrandingLocalization struct {
	Id                 types.String `tfsdk:"id"`
	BackgroundColor    types.String `tfsdk:"background_color"`
	BackgroundImage    types.String `tfsdk:"background_image"`
	BackgroundImageUrl types.String `tfsdk:"background_image_url"`
	BannerLogoUrl      types.String `tfsdk:"banner_logo_url"`
	SignInPageText     types.String `tfsdk:"sign_in_page_text"`
	SquareLogoLight    types.String `tfsdk:"square_logo_light"`
	SquareLogoLightUrl types.String `tfsdk:"square_logo_light_url"`
	SquareLogoDark     types.String `tfsdk:"square_logo_dark"`
	SquareLogoDarkUrl  types.String `tfsdk:"square_logo_dark_url"`
	UsernameHintText   types.String `tfsdk:"username_hint_text"`
	// contains filtered or unexported fields
}

func (*OrganizationalBrandingLocalization) Consume added in v0.4.0

func (*OrganizationalBrandingLocalization) GetBackgroundImageBytes added in v0.4.0

func (o *OrganizationalBrandingLocalization) GetBackgroundImageBytes() []byte

func (*OrganizationalBrandingLocalization) GetBannerLogoBytes added in v0.4.0

func (o *OrganizationalBrandingLocalization) GetBannerLogoBytes() []byte

func (*OrganizationalBrandingLocalization) GetSquareLogoDarkBytes added in v0.4.0

func (o *OrganizationalBrandingLocalization) GetSquareLogoDarkBytes() []byte

func (*OrganizationalBrandingLocalization) GetSquareLogoLightBytes added in v0.4.0

func (o *OrganizationalBrandingLocalization) GetSquareLogoLightBytes() []byte

func (*OrganizationalBrandingLocalization) Populate added in v0.4.0

type Provider

type Provider struct {
	TenantId     types.String `tfsdk:"tenant_id"`
	ClientId     types.String `tfsdk:"client_id"`
	ClientSecret types.String `tfsdk:"client_secret"`
}

func (Provider) GetCredential

func (m Provider) GetCredential() (azcore.TokenCredential, diag.Diagnostics)

func (Provider) GetWithDefault added in v0.4.0

func (m Provider) GetWithDefault(attr types.String, env string) string

Jump to

Keyboard shortcuts

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