Documentation
¶
Index ¶
- func FormatError(err error) string
- func FormatErrorWithAuthGuidance(err error, guidance string) string
- func GetColumnRaw(c client.Client, databaseID, tableID, key string) (map[string]interface{}, error)
- func ImportColumnState(ctx context.Context, req resource.ImportStateRequest, ...)
- func IsColumnNotAvailableError(err error) bool
- func IsNotFoundError(err error) bool
- func OrganizationCredentialGuidance(resourceName string, scopes ...string) string
- func OrganizationIDAttribute() schema.StringAttribute
- func ProjectCredentialGuidance(resourceName string, scopes ...string) string
- func ProjectIDAttribute() schema.StringAttribute
- func ResolveOrganizationID(clients *AppwriteClients, resourceOrganizationID types.String) (string, error)
- func ResolveProjectID(clients *AppwriteClients, resourceProjectID types.String) (string, error)
- func UseStateForUnknownUnlessUpdating() planmodifier.String
- func ValidateOrganizationCredential(clients *AppwriteClients, resourceName string, scopes ...string) error
- func ValidateProjectCredential(clients *AppwriteClients, resourceName string, scopes ...string) error
- func VariableKeyValidators() []validator.String
- func WaitForColumnAvailable(ctx context.Context, getColumn func() (interface{}, error), key string) error
- func WaitForDeploymentReady(ctx context.Context, getDeployment func() (string, error), deploymentID string) error
- func WithUserAgent(version string) client.ClientOption
- type AppwriteClients
- type AttrCheck
- type CredentialType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶
FormatError returns a detailed error string including status code and response body.
func FormatErrorWithAuthGuidance ¶ added in v1.8.0
FormatErrorWithAuthGuidance appends resource-specific credential guidance to authentication and authorization failures returned by Appwrite.
func GetColumnRaw ¶ added in v1.2.0
GetColumnRaw fetches a column using a raw API call, bypassing the SDK's type-matching logic which doesn't handle all column types (e.g. text, longtext, mediumtext, varchar, point, line, polygon).
func ImportColumnState ¶
func ImportColumnState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
ImportColumnState parses a "database_id/table_id/key" import ID into state.
func IsColumnNotAvailableError ¶
IsColumnNotAvailableError checks if the error is due to a column still being processed.
func IsNotFoundError ¶
IsNotFoundError checks if an Appwrite SDK error is a 404.
func OrganizationCredentialGuidance ¶ added in v1.8.0
OrganizationCredentialGuidance describes the credential required by an organization administration resource without exposing any credential value.
func OrganizationIDAttribute ¶ added in v1.8.0
func OrganizationIDAttribute() schema.StringAttribute
OrganizationIDAttribute returns the shared schema attribute for organization_id on organization-scoped resources.
func ProjectCredentialGuidance ¶ added in v1.8.0
ProjectCredentialGuidance describes the credential required by a project-scoped resource without exposing any credential value.
func ProjectIDAttribute ¶ added in v1.0.0
func ProjectIDAttribute() schema.StringAttribute
ProjectIDAttribute returns the shared schema attribute for project_id on resources.
func ResolveOrganizationID ¶ added in v1.8.0
func ResolveOrganizationID(clients *AppwriteClients, resourceOrganizationID types.String) (string, error)
ResolveOrganizationID returns the resource-level organization_id if set, otherwise the provider default. Returns an error if neither is set.
func ResolveProjectID ¶ added in v1.0.0
func ResolveProjectID(clients *AppwriteClients, resourceProjectID types.String) (string, error)
ResolveProjectID returns the resource-level project_id if set, otherwise the provider default. Returns an error if neither is set.
func UseStateForUnknownUnlessUpdating ¶ added in v1.5.0
func UseStateForUnknownUnlessUpdating() planmodifier.String
UseStateForUnknownUnlessUpdating copies the prior-state value into the plan when the planned value is unknown, EXCEPT when this is an update where something else in the resource is actually changing — in which case the value must be left unknown so the API's new timestamp doesn't violate the plan→apply contract.
func ValidateOrganizationCredential ¶ added in v1.8.0
func ValidateOrganizationCredential(clients *AppwriteClients, resourceName string, scopes ...string) error
ValidateOrganizationCredential rejects credentials that are known not to work on organization administration routes. Unknown keys are allowed for compatibility with legacy Appwrite key formats.
func ValidateProjectCredential ¶ added in v1.8.0
func ValidateProjectCredential(clients *AppwriteClients, resourceName string, scopes ...string) error
ValidateProjectCredential rejects credentials that are known not to work on project-scoped server routes. Unknown keys are allowed for compatibility with legacy Appwrite key formats.
func VariableKeyValidators ¶ added in v1.7.1
VariableKeyValidators returns the validators for a variable key, so an unusable key is reported at plan time instead of failing the apply.
func WaitForColumnAvailable ¶ added in v1.0.2
func WaitForColumnAvailable(ctx context.Context, getColumn func() (interface{}, error), key string) error
WaitForColumnAvailable polls a column until its status becomes "available", with a maximum wait of 5 minutes.
func WaitForDeploymentReady ¶ added in v1.1.0
func WaitForDeploymentReady(ctx context.Context, getDeployment func() (string, error), deploymentID string) error
WaitForDeploymentReady polls a deployment until its status becomes "ready", "failed", or "canceled". Returns nil on "ready", error otherwise.
func WithUserAgent ¶ added in v1.3.0
func WithUserAgent(version string) client.ClientOption
WithUserAgent returns a ClientOption that sets the User-Agent header to identify Terraform provider traffic. This is required for HashiCorp partner providers.
Types ¶
type AppwriteClients ¶
type AppwriteClients struct {
// BaseOptions contains the endpoint and project API key options.
BaseOptions []client.ClientOption
// OrganizationBaseOptions contains the endpoint and organization API key
// options. It falls back to BaseOptions for backwards compatibility.
OrganizationBaseOptions []client.ClientOption
// ProjectCredentialType is the detected type of api_key.
ProjectCredentialType CredentialType
// OrganizationCredentialType is the detected type of organization_api_key,
// or api_key when no dedicated organization key is configured.
OrganizationCredentialType CredentialType
// ProjectID is the provider-level default project ID.
ProjectID string
// OrganizationID is the provider-level default organization ID.
OrganizationID string
}
AppwriteClients holds the base configuration for creating SDK clients.
func (*AppwriteClients) ClientForOrganization ¶ added in v1.8.0
func (ac *AppwriteClients) ClientForOrganization(organizationID string) client.Client
ClientForOrganization creates a client targeting the console project and scopes it to an organization. Organization routes have no organization ID in their path, so Appwrite resolves it from X-Appwrite-Organization.
func (*AppwriteClients) ClientForOrganizationProject ¶ added in v1.8.0
func (ac *AppwriteClients) ClientForOrganizationProject(projectID, organizationID string) client.Client
ClientForOrganizationProject creates a project-targeted client authenticated with the organization credential. Console administration routes such as project API key management need both the project and organization headers.
func (*AppwriteClients) ClientForProject ¶ added in v1.0.0
func (ac *AppwriteClients) ClientForProject(projectID string) client.Client
ClientForProject creates a new SDK client targeting a specific project.
type AttrCheck ¶ added in v1.0.2
AttrCheck holds the result of an attribute mismatch check.
func CheckBoolNotIgnored ¶ added in v1.0.2
func CheckBoolNotIgnored(planned types.Bool, actual bool, attrName string, resourceDesc string) AttrCheck
CheckBoolNotIgnored returns an error diagnostic if the planned bool value differs from the API response, indicating the server doesn't support this attribute.
func CheckStringNotIgnored ¶ added in v1.0.2
func CheckStringNotIgnored(planned types.String, actual string, attrName string, resourceDesc string) AttrCheck
CheckStringNotIgnored returns an error diagnostic if the planned string value differs from the API response, indicating the server doesn't support this attribute.
type CredentialType ¶ added in v1.8.0
type CredentialType string
CredentialType identifies the kind of Appwrite API key configured on the provider. Legacy keys without a type prefix are left unknown and validated by the server for backwards compatibility.
const ( CredentialTypeUnknown CredentialType = "unknown" CredentialTypeStandard CredentialType = "standard" CredentialTypeEphemeral CredentialType = "ephemeral" CredentialTypeOrganization CredentialType = "organization" CredentialTypeAccount CredentialType = "account" CredentialTypeOAuth2 CredentialType = "oauth2" )
func DetectCredentialType ¶ added in v1.8.0
func DetectCredentialType(apiKey string) CredentialType
DetectCredentialType returns the type prefix of a modern Appwrite API key. Unknown and legacy key formats are intentionally accepted so the server can validate them.