core

package
v0.118.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Resource          ResourceType = "resource"
	Datasource        ResourceType = "datasource"
	EphemeralResource ResourceType = "ephemeral-resource"

	// Separator used for concatenation of TF-internal resource ID
	Separator = ","

	ResourceRegionFallbackDocstring   = "" /* 129-byte string literal not displayed */
	DatasourceRegionFallbackDocstring = "" /* 131-byte string literal not displayed */
)

Variables

View Source
var DefaultOperationTimeout = 30 * time.Minute
View Source
var DefaultTimeoutMargin = 3 * time.Minute

Functions

func DiagsToError

func DiagsToError(diags diag.Diagnostics) error

DiagsToError Converts TF diagnostics' errors into an error with a human-readable description. If there are no errors, the output is nil

func InitProviderContext added in v0.72.0

func InitProviderContext(ctx context.Context) context.Context

InitProviderContext extends the context to capture the http response

func LogAndAddError

func LogAndAddError(ctx context.Context, diags *diag.Diagnostics, summary, detail string)

LogAndAddError Logs the error and adds it to the diags

func LogAndAddErrorBeta added in v0.20.0

func LogAndAddErrorBeta(ctx context.Context, diags *diag.Diagnostics, name string, resourceType ResourceType)

func LogAndAddWarning

func LogAndAddWarning(ctx context.Context, diags *diag.Diagnostics, summary, detail string)

LogAndAddWarning Logs the warning and adds it to the diags

func LogAndAddWarningBeta added in v0.20.0

func LogAndAddWarningBeta(ctx context.Context, diags *diag.Diagnostics, name string, resourceType ResourceType)

func LogResponse added in v0.72.0

func LogResponse(ctx context.Context) context.Context

LogResponse logs the trace-id of the last request

func NewEphemeralProviderDataInternal added in v0.118.0

func NewEphemeralProviderDataInternal(providerData ProviderData, clientFactory ClientFactory, rt http.RoundTripper) (ephemeralProviderDataInternal, error)

NewEphemeralProviderDataInternal creates a new ephemeralProviderDataInternal struct using the passed ClientFactory implementation.

func NewProviderDataInternal added in v0.118.0

func NewProviderDataInternal(providerData ProviderData, clientFactory ClientFactory) (providerDataInternal, error)

NewProviderDataInternal creates a new providerDataInternal struct using the passed ClientFactory implementation.

func ParseEphemeralProviderData added in v0.118.0

func ParseEphemeralProviderData(ctx context.Context, providerData any, diags *diag.Diagnostics) (EphemeralProviderData, ClientCollection, bool)

ParseEphemeralProviderData is used to extract the EphemeralProviderData struct and the ClientCollection struct from a ephemeralProviderDataInternal struct. Terraform plugin framework doesn't allow for more type safety, that's why any is used.

func ParseProviderData added in v0.118.0

func ParseProviderData(ctx context.Context, providerData any, diags *diag.Diagnostics) (ProviderData, ClientCollection, bool)

ParseProviderData is used to extract the ProviderData struct and the ClientCollection struct from a providerDataInternal struct. Terraform plugin framework doesn't allow for more type safety, that's why any is used.

Types

type ClientCollection added in v0.118.0

type ClientCollection struct {
	AlbCertificatesV2Client     certSdk.DefaultAPI
	AlbV2Client                 alb.DefaultAPI
	AlbWafV1CLient              albwaf.DefaultAPI
	AuthorizationV2Client       authorization.DefaultAPI
	AutomationV1Client          automation.DefaultAPI
	CdnV1Client                 cdn.DefaultAPI
	DnsV1Client                 dns.DefaultAPI
	DremioV1BetaClient          dremio.DefaultAPI
	EdgeV1Client                edge.DefaultAPI
	GitV1BetaClient             git.DefaultAPI
	IaaSv2AlphaClient           iaasv2alpha.DefaultAPI
	IaaSv2Client                iaasv2.DefaultAPI
	IntakeV1BetaClient          intake.DefaultAPI
	KmsV1Client                 kms.DefaultAPI
	LoadbalancerV2Client        loadbalancer.DefaultAPI
	LogmeV2Client               logme.DefaultAPI
	LogsV1Client                logs.DefaultAPI
	MariadbV2Client             mariadb.DefaultAPI
	ModelExperimentsV1Client    modelexperiments.DefaultAPI
	ModelservingV1Client        modelserving.DefaultAPI
	MongoDbFlexV2Client         mongodbflex.DefaultAPI
	ObjectStorageV2Client       objectstorage.DefaultAPI
	ObservabilityV1Client       observability.DefaultAPI
	OpensearchV2Client          opensearch.DefaultAPI
	PostgresflexV3Client        postgresflex.DefaultAPI
	RabbitMqV2Client            rabbitmq.DefaultAPI
	RedisV2Client               redis.DefaultAPI
	ResourceManagerClient       resourcemanager.DefaultAPI
	ScfV1Client                 scf.DefaultAPI
	SecretsmanagerV1AlphaClient secretsmanagerV1Alpha.DefaultAPI
	SecretsmanagerV1Client      secretsmanager.DefaultAPI
	ServerBackupV2Client        serverbackup.DefaultAPI
	ServerUpdateV2Client        serverupdate.DefaultAPI
	ServiceAccountV2Client      serviceaccount.DefaultAPI
	ServiceEnablementV2Client   serviceenablement.DefaultAPI
	SfsV1Client                 sfs.DefaultAPI
	SkeV2Client                 ske.DefaultAPI
	SqlServerFlexV3Client       sqlserverflex.DefaultAPI
	TelemetryLinkV1Client       telemetrylink.DefaultAPI
	TelemetryRouterV1Client     telemetryrouter.DefaultAPI
	ValkeyV2Client              valkey.DefaultAPI
	VpnV1Client                 vpn.DefaultAPI
}

ClientCollection is a collection of clients which are available within each resource, datasource and ephemeral resource implementation.

type ClientFactory added in v0.118.0

type ClientFactory interface {
	// contains filtered or unexported methods
}

type CustomEndpointConfig added in v0.118.0

type CustomEndpointConfig struct {
	ALBCertificatesCustomEndpoint   string
	ALBCustomEndpoint               string
	AlbWafCustomEndpoint            string
	AuthorizationCustomEndpoint     string
	AutomationCustomEndpoint        string
	CdnCustomEndpoint               string
	DnsCustomEndpoint               string
	DremioCustomEndpoint            string
	EdgeCloudCustomEndpoint         string
	GitCustomEndpoint               string
	IaaSCustomEndpoint              string
	IntakeCustomEndpoint            string
	KMSCustomEndpoint               string
	LoadBalancerCustomEndpoint      string
	LogMeCustomEndpoint             string
	LogsCustomEndpoint              string
	MariaDBCustomEndpoint           string
	MongoDBFlexCustomEndpoint       string
	ModelServingCustomEndpoint      string
	ModelExperimentsCustomEndpoint  string
	ObjectStorageCustomEndpoint     string
	ObservabilityCustomEndpoint     string
	OpenSearchCustomEndpoint        string
	PostgresFlexCustomEndpoint      string
	RabbitMQCustomEndpoint          string
	RedisCustomEndpoint             string
	ResourceManagerCustomEndpoint   string
	ScfCustomEndpoint               string
	SecretsManagerCustomEndpoint    string
	SQLServerFlexCustomEndpoint     string
	ServerBackupCustomEndpoint      string
	ServerUpdateCustomEndpoint      string
	SKECustomEndpoint               string
	ServiceEnablementCustomEndpoint string
	SfsCustomEndpoint               string
	ServiceAccountCustomEndpoint    string
	TelemetryLinkCustomEndpoint     string
	TelemetryRouterCustomEndpoint   string
	ValkeyCustomEndpoint            string
	VpnCustomEndpoint               string
}

type DefaultClientFactory added in v0.118.0

type DefaultClientFactory struct {
	RoundTripper    http.RoundTripper
	UserAgent       string
	CustomEndpoints CustomEndpointConfig

	// Deprecated: This should be only used for legacy implementations, not for new ones!
	ProviderDefaultRegion string
}

type EphemeralProviderData added in v0.73.0

type EphemeralProviderData struct {
	ProviderData
	RoundTripper http.RoundTripper
}

EphemeralProviderData is the provider data which should be accessible within ephemeral resource implementations.

type MockClientFactory added in v0.118.0

type MockClientFactory struct {
	AlbCertificatesV2ClientMock     certificates.DefaultAPI
	AutomationV1ClientMock          automation.DefaultAPI
	AlbV2ClientMock                 albSdk.DefaultAPI
	AlbWafV1ClientMock              albWaf.DefaultAPI
	AuthorizationV2ClientMock       authorization.DefaultAPI
	CdnV1ClientMock                 cdnSdk.DefaultAPI
	DnsV1ClientMock                 dns.DefaultAPI
	DremioV2BetaClientMock          dremioSdk.DefaultAPI
	EdgeV1ClientMock                edge.DefaultAPI
	GitV1BetaClientMock             git.DefaultAPI
	IaaSV2ClientMock                iaasV2.DefaultAPI
	IaasV2AlphaClientMock           iaasV2Alpha.DefaultAPI
	IntakeV1BetaClientMock          intake.DefaultAPI
	KmsV1ClientMock                 kms.DefaultAPI
	LoadbalancerV2ClientMock        loadbalancer.DefaultAPI
	LogmeV2ClientMock               logmeSdk.DefaultAPI
	LogsV1ClientMock                logs.DefaultAPI
	MariadbV2ClientMock             mariadb.DefaultAPI
	ModelExperimentsV1ClientMock    modelexperiments.DefaultAPI
	ModelServerV1ClientMock         modelserving.DefaultAPI
	MongoDbFlexV2ClientMock         mongodbflex.DefaultAPI
	ObjectStorageV2ClientMock       objectstorage.DefaultAPI
	ObservabilityV1ClientMock       observabilitySdk.DefaultAPI
	OpensearchV2ClientMock          opensearch.DefaultAPI
	PostgresflexV3ClientMock        postgresflex.DefaultAPI
	RabbitMqV2ClientMock            rabbitmq.DefaultAPI
	RedisV2ClientMock               redis.DefaultAPI
	ResourceManagerClientMock       resourcemanager.DefaultAPI
	ScfV1ClientMock                 scf.DefaultAPI
	SecretsManagerV1AlphaClientMock secretsmanagerV1Alpha.DefaultAPI
	SecretsManagerV1ClientMock      secretsmanager.DefaultAPI
	ServerBackupV2ClientMock        serverbackup.DefaultAPI
	ServerUpdateV2ClientMock        serverupdate.DefaultAPI
	ServiceAccountV2ClientMock      serviceaccount.DefaultAPI
	ServiceEnablementV2ClientMock   serviceenablementV2.DefaultAPI
	SfsV1ClientMock                 sfs.DefaultAPI
	SkeV2ClientMock                 ske.DefaultAPI
	SqlServerFlexV3ClientMock       sqlserverflex.DefaultAPI
	TelemetryLinkV1ClientMock       telemetrylink.DefaultAPI
	TelemetryRouterV1ClientMock     telemetryrouter.DefaultAPI
	ValkeyV2ClientMock              valkey.DefaultAPI
	VpnV1ClientMock                 vpn.DefaultAPI
}

type ProviderData

type ProviderData struct {
	ServiceAccountEmail string
	DefaultRegion       string
	EnableBetaResources bool
	Experiments         []string
}

func (*ProviderData) GetRegion added in v0.44.0

func (pd *ProviderData) GetRegion() string

GetRegion returns the effective region for the provider, falling back to the deprecated _region_ attribute

func (*ProviderData) GetRegionWithOverride added in v0.56.0

func (pd *ProviderData) GetRegionWithOverride(overrideRegion types.String) string

type ResourceType added in v0.57.0

type ResourceType string

type RetryTransport added in v0.118.0

type RetryTransport struct {
	Base        http.RoundTripper
	MaxRetries  int
	BaseBackoff time.Duration
	MaxJitter   time.Duration
}

RetryTransport wraps an underlying RoundTripper to retry on HTTP 429 rate limit errors with jitter.

func (*RetryTransport) RoundTrip added in v0.118.0

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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