Documentation
¶
Index ¶
- Variables
- func AppO11yConfigKind() sdkresource.Kind
- func ErrorToDiagnostics(action ResourceAction, resourceName, resourceType string, err error) diag.Diagnostics
- func GetModelFromMetadata(ctx context.Context, src sdkresource.Object, dst *ResourceMetadataModel) diag.Diagnostics
- func K8sO11yConfigKind() sdkresource.Kind
- func NewResource[T sdkresource.Object, L sdkresource.ListObject](cfg ResourceConfig[T]) resource.Resource
- func ParseFieldPath(resourceType, fieldPath string) path.Path
- func ParseResourceFromModel[T sdkresource.Object](ctx context.Context, src ResourceModel, dst T, specParser SpecParser[T]) diag.Diagnostics
- func ParseResourceOptionsFromModel(ctx context.Context, src ResourceModel, dst *ResourceOptions) diag.Diagnostics
- func SaveResourceToModel[T sdkresource.Object](ctx context.Context, src T, dst *ResourceModel) diag.Diagnostics
- func SetMetadataFromModel(ctx context.Context, src types.Object, dst sdkresource.Object) diag.Diagnostics
- type AppO11yConfig
- func (o *AppO11yConfig) Copy() sdkresource.Object
- func (o *AppO11yConfig) DeepCopyObject() runtime.Object
- func (o *AppO11yConfig) GetCommonMetadata() sdkresource.CommonMetadata
- func (o *AppO11yConfig) GetSpec() any
- func (o *AppO11yConfig) GetStaticMetadata() sdkresource.StaticMetadata
- func (o *AppO11yConfig) GetSubresource(name string) (any, bool)
- func (o *AppO11yConfig) GetSubresources() map[string]any
- func (o *AppO11yConfig) SetCommonMetadata(metadata sdkresource.CommonMetadata)
- func (o *AppO11yConfig) SetSpec(spec any) error
- func (o *AppO11yConfig) SetStaticMetadata(metadata sdkresource.StaticMetadata)
- func (o *AppO11yConfig) SetSubresource(name string, value any) error
- type AppO11yConfigJSONCodec
- type AppO11yConfigList
- type AppO11yConfigSpec
- type AppO11yConfigSpecModel
- type AppO11yConfigStatus
- type DashboardSpecModel
- type FieldError
- type FieldErrors
- type K8sO11yConfig
- func (o *K8sO11yConfig) Copy() sdkresource.Object
- func (o *K8sO11yConfig) DeepCopyObject() runtime.Object
- func (o *K8sO11yConfig) GetCommonMetadata() sdkresource.CommonMetadata
- func (o *K8sO11yConfig) GetSpec() any
- func (o *K8sO11yConfig) GetStaticMetadata() sdkresource.StaticMetadata
- func (o *K8sO11yConfig) GetSubresource(name string) (any, bool)
- func (o *K8sO11yConfig) GetSubresources() map[string]any
- func (o *K8sO11yConfig) SetCommonMetadata(metadata sdkresource.CommonMetadata)
- func (o *K8sO11yConfig) SetSpec(spec any) error
- func (o *K8sO11yConfig) SetStaticMetadata(metadata sdkresource.StaticMetadata)
- func (o *K8sO11yConfig) SetSubresource(name string, value any) error
- type K8sO11yConfigJSONCodec
- type K8sO11yConfigList
- type K8sO11yConfigSpec
- type K8sO11yConfigSpecModel
- type K8sO11yConfigStatus
- type NamedResource
- func AlertEnrichment() NamedResource
- func AppO11yConfigResource() NamedResource
- func Dashboard() NamedResource
- func K8sO11yConfigResource() NamedResource
- func NewNamedResource[T sdkresource.Object, L sdkresource.ListObject](category common.ResourceCategory, cfg ResourceConfig[T]) NamedResource
- func Playlist() NamedResource
- type PlaylistItemModel
- type PlaylistItemValidator
- type PlaylistSpecModel
- type Resource
- func (r *Resource[T, L]) Configure(ctx context.Context, req resource.ConfigureRequest, ...)
- func (r *Resource[T, L]) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *Resource[T, L]) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *Resource[T, L]) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r *Resource[T, L]) Metadata(ctx context.Context, req resource.MetadataRequest, ...)
- func (r *Resource[T, L]) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *Resource[T, L]) Schema(ctx context.Context, req resource.SchemaRequest, res *resource.SchemaResponse)
- func (r *Resource[T, L]) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
- type ResourceAction
- type ResourceConfig
- type ResourceMetadataModel
- type ResourceModel
- type ResourceOptions
- type ResourceOptionsModel
- type ResourceSpecSchema
- type SpecParser
- type SpecSaver
Constants ¶
This section is empty.
Variables ¶
var KnownPlaylistItemTypeValues = []string{ string(v0alpha1.PlaylistItemTypeDashboardByTag), string(v0alpha1.PlaylistItemTypeDashboardByUid), string(v0alpha1.PlaylistItemTypeDashboardById), }
KnownPlaylistItemTypeValues is a list of known playlist item types.
var PlaylistItemType = types.ObjectType{ AttrTypes: map[string]attr.Type{ "type": types.StringType, "value": types.StringType, }, }
PlaylistItemType is the type of the playlist item.
Functions ¶
func AppO11yConfigKind ¶ added in v4.11.1
func AppO11yConfigKind() sdkresource.Kind
AppO11yConfigKind returns the Kind for this resource
func ErrorToDiagnostics ¶
func ErrorToDiagnostics(action ResourceAction, resourceName, resourceType string, err error) diag.Diagnostics
ErrorToDiagnostics formats an error from the Kubernetes API into Terraform diagnostics.
func GetModelFromMetadata ¶
func GetModelFromMetadata( ctx context.Context, src sdkresource.Object, dst *ResourceMetadataModel, ) diag.Diagnostics
GetModelFromMetadata gets the metadata of a resource from the Terraform model.
func K8sO11yConfigKind ¶ added in v4.11.1
func K8sO11yConfigKind() sdkresource.Kind
K8sO11yConfigKind returns the Kind for this resource
func NewResource ¶
func NewResource[T sdkresource.Object, L sdkresource.ListObject](cfg ResourceConfig[T]) resource.Resource
NewResource creates a new Terraform resource for a Grafana resource.
func ParseFieldPath ¶
ParseFieldPath converts a Kubernetes field path into a Terraform path.
func ParseResourceFromModel ¶
func ParseResourceFromModel[T sdkresource.Object]( ctx context.Context, src ResourceModel, dst T, specParser SpecParser[T], ) diag.Diagnostics
ParseResourceFromModel parses a resource model into a resource.
func ParseResourceOptionsFromModel ¶
func ParseResourceOptionsFromModel( ctx context.Context, src ResourceModel, dst *ResourceOptions, ) diag.Diagnostics
ParseResourceOptionsFromModel parses the options of a resource from the Terraform model.
func SaveResourceToModel ¶
func SaveResourceToModel[T sdkresource.Object]( ctx context.Context, src T, dst *ResourceModel, ) diag.Diagnostics
SaveResourceToModel saves a resource to a Terraform model.
func SetMetadataFromModel ¶
func SetMetadataFromModel( ctx context.Context, src types.Object, dst sdkresource.Object, ) diag.Diagnostics
SetMetadataFromModel sets the metadata of a resource from the Terraform config.
Types ¶
type AppO11yConfig ¶ added in v4.11.1
type AppO11yConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec AppO11yConfigSpec `json:"spec"`
Status AppO11yConfigStatus `json:"status"`
}
AppO11yConfig is the main resource type
func (*AppO11yConfig) Copy ¶ added in v4.11.1
func (o *AppO11yConfig) Copy() sdkresource.Object
func (*AppO11yConfig) DeepCopyObject ¶ added in v4.11.1
func (o *AppO11yConfig) DeepCopyObject() runtime.Object
func (*AppO11yConfig) GetCommonMetadata ¶ added in v4.11.1
func (o *AppO11yConfig) GetCommonMetadata() sdkresource.CommonMetadata
func (*AppO11yConfig) GetSpec ¶ added in v4.11.1
func (o *AppO11yConfig) GetSpec() any
func (*AppO11yConfig) GetStaticMetadata ¶ added in v4.11.1
func (o *AppO11yConfig) GetStaticMetadata() sdkresource.StaticMetadata
func (*AppO11yConfig) GetSubresource ¶ added in v4.11.1
func (o *AppO11yConfig) GetSubresource(name string) (any, bool)
func (*AppO11yConfig) GetSubresources ¶ added in v4.11.1
func (o *AppO11yConfig) GetSubresources() map[string]any
func (*AppO11yConfig) SetCommonMetadata ¶ added in v4.11.1
func (o *AppO11yConfig) SetCommonMetadata(metadata sdkresource.CommonMetadata)
func (*AppO11yConfig) SetSpec ¶ added in v4.11.1
func (o *AppO11yConfig) SetSpec(spec any) error
func (*AppO11yConfig) SetStaticMetadata ¶ added in v4.11.1
func (o *AppO11yConfig) SetStaticMetadata(metadata sdkresource.StaticMetadata)
func (*AppO11yConfig) SetSubresource ¶ added in v4.11.1
func (o *AppO11yConfig) SetSubresource(name string, value any) error
type AppO11yConfigJSONCodec ¶ added in v4.11.1
type AppO11yConfigJSONCodec struct{}
AppO11yConfigJSONCodec is a JSON codec for AppO11yConfig
func (*AppO11yConfigJSONCodec) Read ¶ added in v4.11.1
func (*AppO11yConfigJSONCodec) Read(reader io.Reader, into sdkresource.Object) error
Read reads JSON-encoded bytes from reader and unmarshals them into into
func (*AppO11yConfigJSONCodec) Write ¶ added in v4.11.1
func (*AppO11yConfigJSONCodec) Write(writer io.Writer, from sdkresource.Object) error
Write writes JSON-encoded bytes into writer marshaled from from
type AppO11yConfigList ¶ added in v4.11.1
type AppO11yConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []AppO11yConfig `json:"items"`
}
AppO11yConfigList is the list type
func (*AppO11yConfigList) Copy ¶ added in v4.11.1
func (o *AppO11yConfigList) Copy() sdkresource.ListObject
func (*AppO11yConfigList) DeepCopyObject ¶ added in v4.11.1
func (o *AppO11yConfigList) DeepCopyObject() runtime.Object
func (*AppO11yConfigList) GetItems ¶ added in v4.11.1
func (o *AppO11yConfigList) GetItems() []sdkresource.Object
func (*AppO11yConfigList) SetItems ¶ added in v4.11.1
func (o *AppO11yConfigList) SetItems(items []sdkresource.Object)
type AppO11yConfigSpec ¶ added in v4.11.1
type AppO11yConfigSpec struct {
Enabled bool `json:"enabled"`
}
AppO11yConfigSpec is the spec structure
type AppO11yConfigSpecModel ¶ added in v4.11.1
AppO11yConfigSpecModel is a model for the app observability config spec.
type AppO11yConfigStatus ¶ added in v4.11.1
type AppO11yConfigStatus struct {
ProcessedTimestamp time.Time `json:"processedTimestamp"`
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"`
}
AppO11yConfigStatus is the status structure
type DashboardSpecModel ¶
type DashboardSpecModel struct {
JSON jsontypes.Normalized `tfsdk:"json"`
Title types.String `tfsdk:"title"`
Tags types.List `tfsdk:"tags"`
}
DashboardSpecModel is a model for the dashboard spec.
type FieldError ¶
FieldError is a field-level error returned by the Kubernetes API, with the path and messages adapted to Terraform diagnostics.
type FieldErrors ¶
type FieldErrors map[string]FieldError
FieldErrors is a map of field names to FieldError instances.
func FieldErrorsFromCauses ¶
func FieldErrorsFromCauses(resourceType string, causes []metav1.StatusCause) FieldErrors
FieldErrorsFromCauses converts a list of field errors returned by the Kubernetes API into a map of Terraform-acceptable field-level errors.
type K8sO11yConfig ¶ added in v4.11.1
type K8sO11yConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec K8sO11yConfigSpec `json:"spec"`
Status K8sO11yConfigStatus `json:"status"`
}
K8sO11yConfig is the main resource type
func (*K8sO11yConfig) Copy ¶ added in v4.11.1
func (o *K8sO11yConfig) Copy() sdkresource.Object
func (*K8sO11yConfig) DeepCopyObject ¶ added in v4.11.1
func (o *K8sO11yConfig) DeepCopyObject() runtime.Object
func (*K8sO11yConfig) GetCommonMetadata ¶ added in v4.11.1
func (o *K8sO11yConfig) GetCommonMetadata() sdkresource.CommonMetadata
func (*K8sO11yConfig) GetSpec ¶ added in v4.11.1
func (o *K8sO11yConfig) GetSpec() any
func (*K8sO11yConfig) GetStaticMetadata ¶ added in v4.11.1
func (o *K8sO11yConfig) GetStaticMetadata() sdkresource.StaticMetadata
func (*K8sO11yConfig) GetSubresource ¶ added in v4.11.1
func (o *K8sO11yConfig) GetSubresource(name string) (any, bool)
func (*K8sO11yConfig) GetSubresources ¶ added in v4.11.1
func (o *K8sO11yConfig) GetSubresources() map[string]any
func (*K8sO11yConfig) SetCommonMetadata ¶ added in v4.11.1
func (o *K8sO11yConfig) SetCommonMetadata(metadata sdkresource.CommonMetadata)
func (*K8sO11yConfig) SetSpec ¶ added in v4.11.1
func (o *K8sO11yConfig) SetSpec(spec any) error
func (*K8sO11yConfig) SetStaticMetadata ¶ added in v4.11.1
func (o *K8sO11yConfig) SetStaticMetadata(metadata sdkresource.StaticMetadata)
func (*K8sO11yConfig) SetSubresource ¶ added in v4.11.1
func (o *K8sO11yConfig) SetSubresource(name string, value any) error
type K8sO11yConfigJSONCodec ¶ added in v4.11.1
type K8sO11yConfigJSONCodec struct{}
K8sO11yConfigJSONCodec is a JSON codec for K8sO11yConfig
func (*K8sO11yConfigJSONCodec) Read ¶ added in v4.11.1
func (*K8sO11yConfigJSONCodec) Read(reader io.Reader, into sdkresource.Object) error
Read reads JSON-encoded bytes from reader and unmarshals them into into
func (*K8sO11yConfigJSONCodec) Write ¶ added in v4.11.1
func (*K8sO11yConfigJSONCodec) Write(writer io.Writer, from sdkresource.Object) error
Write writes JSON-encoded bytes into writer marshaled from from
type K8sO11yConfigList ¶ added in v4.11.1
type K8sO11yConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []K8sO11yConfig `json:"items"`
}
K8sO11yConfigList is the list type
func (*K8sO11yConfigList) Copy ¶ added in v4.11.1
func (o *K8sO11yConfigList) Copy() sdkresource.ListObject
func (*K8sO11yConfigList) DeepCopyObject ¶ added in v4.11.1
func (o *K8sO11yConfigList) DeepCopyObject() runtime.Object
func (*K8sO11yConfigList) GetItems ¶ added in v4.11.1
func (o *K8sO11yConfigList) GetItems() []sdkresource.Object
func (*K8sO11yConfigList) SetItems ¶ added in v4.11.1
func (o *K8sO11yConfigList) SetItems(items []sdkresource.Object)
type K8sO11yConfigSpec ¶ added in v4.11.1
type K8sO11yConfigSpec struct {
Enabled bool `json:"enabled"`
}
K8sO11yConfigSpec is the spec structure
type K8sO11yConfigSpecModel ¶ added in v4.11.1
K8sO11yConfigSpecModel is a model for the Kubernetes observability config spec.
type K8sO11yConfigStatus ¶ added in v4.11.1
type K8sO11yConfigStatus struct {
ProcessedTimestamp time.Time `json:"processedTimestamp"`
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"`
}
K8sO11yConfigStatus is the status structure
type NamedResource ¶
type NamedResource struct {
Resource resource.Resource
Name string
Category common.ResourceCategory
}
NamedResource is a Resource with a name and category.
func AlertEnrichment ¶ added in v4.6.0
func AlertEnrichment() NamedResource
AlertEnrichment creates a new Grafana Alert Enrichment resource
func AppO11yConfigResource ¶ added in v4.11.1
func AppO11yConfigResource() NamedResource
AppO11yConfigResource creates a new Grafana App Observability Config resource. Note: This is a singleton resource - there can only be one per namespace
func K8sO11yConfigResource ¶ added in v4.11.1
func K8sO11yConfigResource() NamedResource
K8sO11yConfigResource creates a new Grafana Kubernetes Observability Config resource. Note: This is a singleton resource - there can only be one per namespace
func NewNamedResource ¶
func NewNamedResource[T sdkresource.Object, L sdkresource.ListObject]( category common.ResourceCategory, cfg ResourceConfig[T], ) NamedResource
NewNamedResource creates a new Terraform resource for a Grafana resource. The named resource contains the name of the resource and its category.
type PlaylistItemModel ¶
type PlaylistItemModel struct {
Type types.String `tfsdk:"type"`
Value types.String `tfsdk:"value"`
}
PlaylistItemModel is a model for the playlist item.
type PlaylistItemValidator ¶
type PlaylistItemValidator struct{}
PlaylistItemValidator is a validator for the playlist item. It ensures that the playlist item type is one of the known values.
func (PlaylistItemValidator) Description ¶
func (v PlaylistItemValidator) Description(_ context.Context) string
Description returns the description of the validator.
func (PlaylistItemValidator) MarkdownDescription ¶
func (v PlaylistItemValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription returns the markdown description of the validator.
func (PlaylistItemValidator) ValidateList ¶
func (v PlaylistItemValidator) ValidateList( ctx context.Context, req validator.ListRequest, resp *validator.ListResponse, )
ValidateList validates the playlist item. It ensures that the playlist item type is one of the known values.
type PlaylistSpecModel ¶
type PlaylistSpecModel struct {
Title types.String `tfsdk:"title"`
Interval types.String `tfsdk:"interval"`
Items types.List `tfsdk:"items"`
}
PlaylistSpecModel is a model for the playlist spec.
type Resource ¶
type Resource[T sdkresource.Object, L sdkresource.ListObject] struct { // contains filtered or unexported fields }
Resource is a generic Terraform resource for a Grafana resource.
func (*Resource[T, L]) Configure ¶
func (r *Resource[T, L]) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
Configure initializes the Resource.
func (*Resource[T, L]) Create ¶
func (r *Resource[T, L]) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
Create creates a new Grafana resource.
func (*Resource[T, L]) Delete ¶
func (r *Resource[T, L]) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
Delete deletes the Grafana resource.
func (*Resource[T, L]) ImportState ¶
func (r *Resource[T, L]) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
ImportState imports the state of the Grafana resource.
func (*Resource[T, L]) Metadata ¶
func (r *Resource[T, L]) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
Metadata returns the metadata for the Resource.
func (*Resource[T, L]) Read ¶
func (r *Resource[T, L]) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
Read reads the Grafana resource.
func (*Resource[T, L]) Schema ¶
func (r *Resource[T, L]) Schema(ctx context.Context, req resource.SchemaRequest, res *resource.SchemaResponse)
Schema returns the schema for the Resource.
func (*Resource[T, L]) Update ¶
func (r *Resource[T, L]) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
Update updates the Grafana resource.
type ResourceAction ¶
type ResourceAction string
ResourceAction is the action that is being performed on the resource.
const ( ResourceActionCreate ResourceAction = "create" ResourceActionUpdate ResourceAction = "update" ResourceActionDelete ResourceAction = "delete" ResourceActionRead ResourceAction = "read" )
type ResourceConfig ¶
type ResourceConfig[T sdkresource.Object] struct { Schema ResourceSpecSchema Kind sdkresource.Kind SpecParser SpecParser[T] SpecSaver SpecSaver[T] }
ResourceConfig is a configuration for a Grafana resource.
type ResourceMetadataModel ¶
type ResourceMetadataModel struct {
UUID types.String `tfsdk:"uuid"`
UID types.String `tfsdk:"uid"`
FolderUID types.String `tfsdk:"folder_uid"`
Version types.String `tfsdk:"version"`
URL types.String `tfsdk:"url"`
Annotations types.Map `tfsdk:"annotations"`
}
ResourceMetadataModel is a Terraform model for the metadata of a Grafana resource.
type ResourceModel ¶
type ResourceModel struct {
ID types.String `tfsdk:"id"`
Metadata types.Object `tfsdk:"metadata"`
Spec types.Object `tfsdk:"spec"`
Options types.Object `tfsdk:"options"`
}
ResourceModel is a Terraform model for a Grafana resource.
type ResourceOptions ¶
ResourceOptions is a struct for the options of a Grafana resource.
type ResourceOptionsModel ¶
ResourceOptionsModel is a Terraform model for the options of a Grafana resource.
type ResourceSpecSchema ¶
type ResourceSpecSchema struct {
Description string
MarkdownDescription string
DeprecationMessage string
SpecAttributes map[string]schema.Attribute
SpecBlocks map[string]schema.Block
}
ResourceSpecSchema is the Terraform schema for a Grafana resource spec.
type SpecParser ¶
type SpecParser[T sdkresource.Object] func(ctx context.Context, src types.Object, dst T) diag.Diagnostics
SpecParser is a function that parses a resource spec from a Terraform model.
type SpecSaver ¶
type SpecSaver[T sdkresource.Object] func(ctx context.Context, src T, dst *ResourceModel) diag.Diagnostics
SpecSaver is a function that saves a resource spec to a Terraform model.