transport

package
v0.0.0-...-7000f67 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MPL-2.0 Imports: 91 Imported by: 0

Documentation

Overview

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0

Index

Constants

View Source
const AccessApprovalBasePathKey = "AccessApproval"
View Source
const AccessContextManagerBasePathKey = "AccessContextManager"
View Source
const ActiveDirectoryBasePathKey = "ActiveDirectory"
View Source
const AlloydbBasePathKey = "Alloydb"
View Source
const ApiGatewayBasePathKey = "ApiGateway"
View Source
const ApigeeBasePathKey = "Apigee"
View Source
const AppEngineBasePathKey = "AppEngine"
View Source
const ArtifactRegistryBasePathKey = "ArtifactRegistry"
View Source
const BackupDRBasePathKey = "BackupDR"
View Source
const BeyondcorpBasePathKey = "Beyondcorp"
View Source
const BigQueryBasePathKey = "BigQuery"
View Source
const BiglakeBasePathKey = "Biglake"
View Source
const BigqueryAnalyticsHubBasePathKey = "BigqueryAnalyticsHub"
View Source
const BigqueryConnectionBasePathKey = "BigqueryConnection"
View Source
const BigqueryDataTransferBasePathKey = "BigqueryDataTransfer"
View Source
const BigqueryDatapolicyBasePathKey = "BigqueryDatapolicy"
View Source
const BigqueryReservationBasePathKey = "BigqueryReservation"
View Source
const BigtableAdminBasePathKey = "BigtableAdmin"
View Source
const BigtableBasePathKey = "Bigtable"
View Source
const BillingBasePathKey = "Billing"
View Source
const BinaryAuthorizationBasePathKey = "BinaryAuthorization"
View Source
const CertificateManagerBasePathKey = "CertificateManager"
View Source
const CloudAssetBasePathKey = "CloudAsset"
View Source
const CloudBillingBasePathKey = "CloudBilling"
View Source
const CloudBuildBasePathKey = "CloudBuild"
View Source
const CloudFunctionsBasePathKey = "CloudFunctions"
View Source
const CloudIdentityBasePathKey = "CloudIdentity"
View Source
const CloudIdsBasePathKey = "CloudIds"
View Source
const CloudIotBasePathKey = "CloudIot"
View Source
const CloudRunBasePathKey = "CloudRun"
View Source
const CloudRunV2BasePathKey = "CloudRunV2"
View Source
const CloudSchedulerBasePathKey = "CloudScheduler"
View Source
const CloudTasksBasePathKey = "CloudTasks"
View Source
const Cloudbuildv2BasePathKey = "Cloudbuildv2"
View Source
const Cloudfunctions2BasePathKey = "Cloudfunctions2"
View Source
const ComposerBasePathKey = "Composer"
View Source
const ComputeBasePathKey = "Compute"
View Source
const ContainerAnalysisBasePathKey = "ContainerAnalysis"
View Source
const ContainerAttachedBasePathKey = "ContainerAttached"
View Source
const ContainerAwsBasePathKey = "ContainerAws"
View Source
const ContainerAzureBasePathKey = "ContainerAzure"
View Source
const ContainerBasePathKey = "Container"
View Source
const CoreBillingBasePathKey = "CoreBilling"
View Source
const DNSBasePathKey = "DNS"
View Source
const DataCatalogBasePathKey = "DataCatalog"
View Source
const DataFusionBasePathKey = "DataFusion"
View Source
const DataLossPreventionBasePathKey = "DataLossPrevention"
View Source
const DatabaseMigrationServiceBasePathKey = "DatabaseMigrationService"
View Source
const DataflowBasePathKey = "Dataflow"
View Source
const DataformBasePathKey = "Dataform"
View Source
const DataplexBasePathKey = "Dataplex"
View Source
const DataprocBasePathKey = "Dataproc"
View Source
const DataprocMetastoreBasePathKey = "DataprocMetastore"
View Source
const DatastoreBasePathKey = "Datastore"
View Source
const DatastreamBasePathKey = "Datastream"
View Source
const DefaultBatchSendIntervalSec = 3
View Source
const DeploymentManagerBasePathKey = "DeploymentManager"
View Source
const DialogflowBasePathKey = "Dialogflow"
View Source
const DialogflowCXBasePathKey = "DialogflowCX"
View Source
const DocumentAIBasePathKey = "DocumentAI"
View Source
const DocumentAIWarehouseBasePathKey = "DocumentAIWarehouse"
View Source
const EssentialContactsBasePathKey = "EssentialContacts"
View Source
const FilestoreBasePathKey = "Filestore"
View Source
const FirebaseBasePathKey = "Firebase"
View Source
const FirebaseDatabaseBasePathKey = "FirebaseDatabase"
View Source
const FirebaseExtensionsBasePathKey = "FirebaseExtensions"
View Source
const FirebaseHostingBasePathKey = "FirebaseHosting"
View Source
const FirebaseStorageBasePathKey = "FirebaseStorage"
View Source
const FirestoreBasePathKey = "Firestore"
View Source
const GKEBackupBasePathKey = "GKEBackup"
View Source
const GKEHub2BasePathKey = "GKEHub2"
View Source
const GKEHubBasePathKey = "GKEHub"
View Source
const GameServicesBasePathKey = "GameServices"
View Source
const GkeonpremBasePathKey = "Gkeonprem"
View Source
const HealthcareBasePathKey = "Healthcare"
View Source
const IAM2BasePathKey = "IAM2"
View Source
const IAMBasePathKey = "IAM"
View Source
const IAMBetaBasePathKey = "IAMBeta"
View Source
const IAMWorkforcePoolBasePathKey = "IAMWorkforcePool"
View Source
const IamCredentialsBasePathKey = "IamCredentials"
View Source
const IapBasePathKey = "Iap"
View Source
const IdentityPlatformBasePathKey = "IdentityPlatform"
View Source
const KMSBasePathKey = "KMS"
View Source
const LoggingBasePathKey = "Logging"
View Source
const LookerBasePathKey = "Looker"
View Source
const METADATA_FINGERPRINT_RETRIES = 10
View Source
const MLEngineBasePathKey = "MLEngine"
View Source
const MemcacheBasePathKey = "Memcache"
View Source
const MonitoringBasePathKey = "Monitoring"
View Source
const NetworkConnectivityBasePathKey = "NetworkConnectivity"
View Source
const NetworkManagementBasePathKey = "NetworkManagement"
View Source
const NetworkSecurityBasePathKey = "NetworkSecurity"
View Source
const NetworkServicesBasePathKey = "NetworkServices"
View Source
const NotebooksBasePathKey = "Notebooks"
View Source
const OSConfigBasePathKey = "OSConfig"
View Source
const OSLoginBasePathKey = "OSLogin"
View Source
const OrgPolicyBasePathKey = "OrgPolicy"
View Source
const PrivatecaBasePathKey = "Privateca"
View Source
const PublicCABasePathKey = "PublicCA"
View Source
const PubsubBasePathKey = "Pubsub"
View Source
const PubsubLiteBasePathKey = "PubsubLite"
View Source
const RedisBasePathKey = "Redis"
View Source
const ResourceManagerBasePathKey = "ResourceManager"
View Source
const ResourceManagerV3BasePathKey = "ResourceManagerV3"
View Source
const RuntimeConfigBasePathKey = "RuntimeConfig"
View Source
const SQLBasePathKey = "SQL"
View Source
const SecretManagerBasePathKey = "SecretManager"
View Source
const SecurityCenterBasePathKey = "SecurityCenter"
View Source
const SecurityScannerBasePathKey = "SecurityScanner"
View Source
const ServiceDirectoryBasePathKey = "ServiceDirectory"
View Source
const ServiceManagementBasePathKey = "ServiceManagement"
View Source
const ServiceNetworkingBasePathKey = "ServiceNetworking"
View Source
const ServiceUsageBasePathKey = "ServiceUsage"
View Source
const SourceRepoBasePathKey = "SourceRepo"
View Source
const SpannerBasePathKey = "Spanner"
View Source
const StorageBasePathKey = "Storage"
View Source
const StorageTransferBasePathKey = "StorageTransfer"
View Source
const TPUBasePathKey = "TPU"
View Source
const TagsBasePathKey = "Tags"
View Source
const TagsLocationBasePathKey = "TagsLocation"
View Source
const TestFakeCredentialsPath = "../test-fixtures/fake_account.json"
View Source
const VPCAccessBasePathKey = "VPCAccess"
View Source
const VertexAIBasePathKey = "VertexAI"
View Source
const VmwareengineBasePathKey = "Vmwareengine"
View Source
const WorkflowsBasePathKey = "Workflows"
View Source
const WorkstationsBasePathKey = "Workstations"

Variables

View Source
var ApikeysEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var ApikeysEndpointEntryKey = "apikeys_custom_endpoint"
View Source
var AssuredWorkloadsEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var AssuredWorkloadsEndpointEntryKey = "assured_workloads_custom_endpoint"
View Source
var BigtableAdminCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
	DefaultFunc: schema.MultiEnvDefaultFunc([]string{
		"GOOGLE_BIGTABLE_CUSTOM_ENDPOINT",
	}, DefaultBasePaths[BigtableAdminBasePathKey]),
}
View Source
var BigtableAdminCustomEndpointEntryKey = "bigtable_custom_endpoint"
View Source
var CloudBillingCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var CloudBillingCustomEndpointEntryKey = "cloud_billing_custom_endpoint"
View Source
var CloudBuildWorkerPoolEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var CloudBuildWorkerPoolEndpointEntryKey = "cloud_build_worker_pool_custom_endpoint"
View Source
var CloudResourceManagerEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var CloudResourceManagerEndpointEntryKey = "cloud_resource_manager_custom_endpoint"
View Source
var ClouddeployEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var ClouddeployEndpointEntryKey = "clouddeploy_custom_endpoint"
View Source
var ComposerCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var ComposerCustomEndpointEntryKey = "composer_custom_endpoint"
View Source
var ContainerAwsCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var ContainerAwsCustomEndpointEntryKey = "container_aws_custom_endpoint"
View Source
var ContainerAzureCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var ContainerAzureCustomEndpointEntryKey = "container_azure_custom_endpoint"
View Source
var ContainerCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var ContainerCustomEndpointEntryKey = "container_custom_endpoint"
View Source
var DataflowCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var DataflowCustomEndpointEntryKey = "dataflow_custom_endpoint"
View Source
var DefaultBasePaths = map[string]string{}/* 123 elements not displayed */

Generated product base paths

View Source
var DefaultClientScopes = []string{
	"https://www.googleapis.com/auth/cloud-platform",
	"https://www.googleapis.com/auth/userinfo.email",
}
View Source
var DefaultRequestTimeout = 5 * time.Minute
View Source
var EventarcEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var EventarcEndpointEntryKey = "eventarc_custom_endpoint"
View Source
var FINGERPRINT_FAIL_ERRORS = []string{"Invalid fingerprint.", "Supplied fingerprint does not match current metadata fingerprint."}

We've encountered a few common fingerprint-related strings; if this is one of them, we're confident this is an error due to fingerprints.

View Source
var FirebaserulesEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var FirebaserulesEndpointEntryKey = "firebaserules_custom_endpoint"
View Source
var GKEHubFeatureEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var GKEHubFeatureEndpointEntryKey = "gkehub_feature_custom_endpoint"
View Source
var IAMCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var IAMCustomEndpointEntryKey = "iam_custom_endpoint"
View Source
var IamCredentialsCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var IamCredentialsCustomEndpointEntryKey = "iam_credentials_custom_endpoint"
View Source
var MutexStore = NewMutexKV()

Global MutexKV

View Source
var NetworkConnectivityEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var NetworkConnectivityEndpointEntryKey = "network_connectivity_custom_endpoint"
View Source
var PrivatecaCertificateTemplateCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
	DefaultFunc: schema.MultiEnvDefaultFunc([]string{
		"GOOGLE_PRIVATECA_CUSTOM_ENDPOINT",
	}, DefaultBasePaths[PrivatecaBasePathKey]),
}
View Source
var PrivatecaCertificateTemplateEndpointEntryKey = "privateca_custom_endpoint"
View Source
var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
	Type:     schema.TypeString,
	Optional: true,
}
View Source
var RecaptchaEnterpriseEndpointEntryKey = "recaptcha_enterprise_custom_endpoint"
View Source
var ResourceManagerV3CustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var ResourceManagerV3CustomEndpointEntryKey = "resource_manager_v3_custom_endpoint"
View Source
var RuntimeConfigCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var RuntimeConfigCustomEndpointEntryKey = "runtimeconfig_custom_endpoint"
View Source
var ServiceNetworkingCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var ServiceNetworkingCustomEndpointEntryKey = "service_networking_custom_endpoint"
View Source
var ServiceUsageCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
	DefaultFunc: schema.MultiEnvDefaultFunc([]string{
		"GOOGLE_SERVICE_USAGE_CUSTOM_ENDPOINT",
	}, DefaultBasePaths[ServiceUsageBasePathKey]),
}
View Source
var ServiceUsageCustomEndpointEntryKey = "service_usage_custom_endpoint"
View Source
var TagsLocationCustomEndpointEntry = &schema.Schema{
	Type:         schema.TypeString,
	Optional:     true,
	ValidateFunc: ValidateCustomEndpoint,
}
View Source
var TagsLocationCustomEndpointEntryKey = "tags_location_custom_endpoint"
View Source
var TimeoutErr = &TimeoutError{timeout: true}

Functions

func AddQueryParams

func AddQueryParams(rawurl string, params map[string]string) (string, error)

func ClientWithAdditionalRetries

func ClientWithAdditionalRetries(baseClient *http.Client, predicates ...RetryErrorPredicateFunc) *http.Client

Helper method to create a shallow copy of an HTTP client with a shallow-copied retryTransport s.t. the base HTTP transport is the same (i.e. client connection pools are shared, retryPredicates are different)

func ConfigureBasePaths

func ConfigureBasePaths(c *Config)

For a consumer of config.go that isn't a full fledged provider and doesn't have its own endpoint mechanism such as sweepers, init {{service}}BasePath values to a default. After using this, you should call config.LoadAndValidate.

func ConfigureDCLCustomEndpointAttributesFramework

func ConfigureDCLCustomEndpointAttributesFramework(frameworkSchema *framework_schema.Schema)

plugin-framework provider set-up

func ConfigureDCLProvider

func ConfigureDCLProvider(provider *schema.Provider)

func CustomEndpointValidator

func CustomEndpointValidator() validator.String

func DatastoreIndex409Contention

func DatastoreIndex409Contention(err error) (bool, string)

func GetCurrentUserEmail

func GetCurrentUserEmail(config *Config, userAgent string) (string, error)
func GetRegionFromRegionSelfLink(selfLink string) string

return the region a selfLink is referring to

func HandleDCLCustomEndpointDefaults

func HandleDCLCustomEndpointDefaults(d *schema.ResourceData)

func HandleNotFoundError

func HandleNotFoundError(err error, d *schema.ResourceData, resource string) error

func HandleSDKDefaults

func HandleSDKDefaults(d *schema.ResourceData) error

func HealthcareDatasetNotInitialized

func HealthcareDatasetNotInitialized(err error) (bool, string)

func IamMemberMissing

func IamMemberMissing(err error) (bool, string)

If a permission necessary to provision a resource is created in the same config as the resource itself, the permission may not have propagated by the time terraform attempts to create the resource. This allows those errors to be retried until the timeout expires

func IamServiceAccountNotFound

func IamServiceAccountNotFound(err error) (bool, string)

If a service account is deleted in the middle of updating an IAM policy it can cause the API to return an error. In fine-grained IAM resources we read the policy, modify it, then send it back to the API. Retrying is useful particularly in high-traffic projects. We don't want to retry _every_ time we see this error because the user-provided SA could trigger this too. At the callsite, we should check if the current etag matches the old etag and short-circuit if they do as that indicates the new config is the likely problem.

func IapClient409Operation

func IapClient409Operation(err error) (bool, string)

func Is429QuotaError

func Is429QuotaError(err error) (bool, string)

Do not retry if operation returns a 429

func IsApiNotEnabledError

func IsApiNotEnabledError(err error) bool

func IsApigeeRetryableError

func IsApigeeRetryableError(err error) (bool, string)

Concurrent Apigee operations can fail with a 400 error

func IsAppEngineRetryableError

func IsAppEngineRetryableError(err error) (bool, string)

Retry if App Engine operation returns a 409 with a specific message for concurrent operations, or a 404 indicating p4sa has not yet propagated.

func IsBigTableRetryableError

func IsBigTableRetryableError(err error) (bool, string)

Bigtable uses gRPC and thus does not return errors of type *googleapi.Error. Instead the errors returned are *status.Error. See the types of codes returned here (https://pkg.go.dev/google.golang.org/grpc/codes#Code).

func IsBigqueryIAMQuotaError

func IsBigqueryIAMQuotaError(err error) (bool, string)

Retry if Bigquery operation returns a 403 with a specific message for concurrent operations (which are implemented in terms of 'edit quota').

func IsCloudRunCreationConflict

func IsCloudRunCreationConflict(err error) (bool, string)

Cloud Run APIs may return a 409 on create to indicate that a resource has been deleted in the foreground (eg GET and LIST) but not the backing apiserver. When we encounter a 409, we can retry it. Note that due to limitations in MMv1's error_retry_predicates this is currently applied to all requests. We only expect to receive it on create, though.

func IsCryptoKeyVersionsPendingGeneration

func IsCryptoKeyVersionsPendingGeneration(err error) (bool, string)

Retry if KMS CryptoKeyVersions returns a 400 for PENDING_GENERATION

func IsDataflowJobUpdateRetryableError

func IsDataflowJobUpdateRetryableError(err error) (bool, string)

func IsFingerprintError

func IsFingerprintError(err error) (bool, string)

Retry the operation if it looks like a fingerprint mismatch.

func IsGoogleApiErrorWithCode

func IsGoogleApiErrorWithCode(err error, errCode int) bool

func IsMonitoringConcurrentEditError

func IsMonitoringConcurrentEditError(err error) (bool, string)

Retry if Monitoring operation returns a 409 with a specific message for concurrent operations.

func IsMonitoringPermissionError

func IsMonitoringPermissionError(err error) (bool, string)

Retry if Monitoring operation returns a 403

func IsPeeringOperationInProgress

func IsPeeringOperationInProgress(err error) (bool, string)

func IsRetryableError

func IsRetryableError(topErr error, retryPredicates, abortPredicates []RetryErrorPredicateFunc) bool

func IsSqlOperationInProgressError

func IsSqlOperationInProgressError(err error) (bool, string)

Retry if Cloud SQL operation returns a 429 with a specific message for concurrent operations.

func IsSwgAutogenRouterRetryable

func IsSwgAutogenRouterRetryable(err error) (bool, string)

Gateway of type 'SECURE_WEB_GATEWAY' automatically creates a router but does not delete it. This router might be re-used by other gateways located in the same network. When multiple gateways are being deleted at the same time, multiple attempts to delete the same router will be triggered and the api throws an error saying the "The resource <router> is not ready".

func LockedCall

func LockedCall(lockKey string, f func() error) error

func MetadataRetryWrapper

func MetadataRetryWrapper(update func() error) error

Since the google compute API uses optimistic locking, there is a chance we need to resubmit our updated metadata. To do this, you need to provide an update function that attempts to submit your metadata

func MultiEnvDefault

func MultiEnvDefault(ks []string, dv interface{}) interface{}

MultiEnvDefault is a helper function that returns the value of the first environment variable in the given list that returns a non-empty value. If none of the environment variables return a value, the default value is returned.

func MultiEnvSearch

func MultiEnvSearch(ks []string) string

func NewDCLApikeysClient

func NewDCLApikeysClient(config *Config, userAgent, billingProject string, timeout time.Duration) *apikeys.Client

func NewDCLAssuredWorkloadsClient

func NewDCLAssuredWorkloadsClient(config *Config, userAgent, billingProject string, timeout time.Duration) *assuredworkloads.Client

func NewDCLBigqueryReservationClient

func NewDCLBigqueryReservationClient(config *Config, userAgent, billingProject string, timeout time.Duration) *bigqueryreservation.Client

func NewDCLCloudResourceManagerClient

func NewDCLCloudResourceManagerClient(config *Config, userAgent, billingProject string, timeout time.Duration) *cloudresourcemanager.Client

func NewDCLCloudbuildClient

func NewDCLCloudbuildClient(config *Config, userAgent, billingProject string, timeout time.Duration) *cloudbuild.Client

func NewDCLCloudbuildv2Client

func NewDCLCloudbuildv2Client(config *Config, userAgent, billingProject string, timeout time.Duration) *cloudbuildv2.Client

func NewDCLClouddeployClient

func NewDCLClouddeployClient(config *Config, userAgent, billingProject string, timeout time.Duration) *clouddeploy.Client

func NewDCLComputeClient

func NewDCLComputeClient(config *Config, userAgent, billingProject string, timeout time.Duration) *compute.Client

func NewDCLContainerAwsClient

func NewDCLContainerAwsClient(config *Config, userAgent, billingProject string, timeout time.Duration) *containeraws.Client

func NewDCLContainerAzureClient

func NewDCLContainerAzureClient(config *Config, userAgent, billingProject string, timeout time.Duration) *containerazure.Client

func NewDCLDataplexClient

func NewDCLDataplexClient(config *Config, userAgent, billingProject string, timeout time.Duration) *dataplex.Client

func NewDCLDataprocClient

func NewDCLDataprocClient(config *Config, userAgent, billingProject string, timeout time.Duration) *dataproc.Client

func NewDCLEventarcClient

func NewDCLEventarcClient(config *Config, userAgent, billingProject string, timeout time.Duration) *eventarc.Client

func NewDCLFirebaserulesClient

func NewDCLFirebaserulesClient(config *Config, userAgent, billingProject string, timeout time.Duration) *firebaserules.Client

func NewDCLGkeHubClient

func NewDCLGkeHubClient(config *Config, userAgent, billingProject string, timeout time.Duration) *gkehub.Client

func NewDCLNetworkConnectivityClient

func NewDCLNetworkConnectivityClient(config *Config, userAgent, billingProject string, timeout time.Duration) *networkconnectivity.Client

func NewDCLOrgPolicyClient

func NewDCLOrgPolicyClient(config *Config, userAgent, billingProject string, timeout time.Duration) *orgpolicy.Client

func NewDCLPrivatecaClient

func NewDCLPrivatecaClient(config *Config, userAgent, billingProject string, timeout time.Duration) *privateca.Client

func NewDCLRecaptchaEnterpriseClient

func NewDCLRecaptchaEnterpriseClient(config *Config, userAgent, billingProject string, timeout time.Duration) *recaptchaenterprise.Client

func NewTransportWithDefaultRetries

func NewTransportWithDefaultRetries(t http.RoundTripper) *retryTransport

NewTransportWithDefaultRetries constructs a default retryTransport that will retry common temporary errors

func NewTransportWithHeaders

func NewTransportWithHeaders(baseTransit http.RoundTripper) headerTransportLayer

func PollingWaitTime

func PollingWaitTime(pollF PollReadFunc, checkResponse PollCheckResponseFunc, activity string,
	timeout time.Duration, targetOccurrences int) error

func ProviderDCLConfigure

func ProviderDCLConfigure(d *schema.ResourceData, config *Config) interface{}

func PubsubTopicProjectNotReady

func PubsubTopicProjectNotReady(err error) (bool, string)

Cloud PubSub returns a 400 error if a topic's parent project was recently created and an organization policy has not propagated. See https://github.com/hashicorp/terraform-provider-google/issues/4349

func RemoveBasePathVersion

func RemoveBasePathVersion(url string) string

Remove the `/{{version}}/` from a base path if present.

func Retry

func Retry(opt RetryOptions) error

func RetryWithTargetOccurrences

func RetryWithTargetOccurrences(timeout time.Duration, targetOccurrences int,
	f resource.RetryFunc) error

RetryWithTargetOccurrences is a basic wrapper around StateChangeConf that will retry a function until it returns the specified amount of target occurrences continuously. Adapted from the Retry function in the go SDK.

func SendRequest

func SendRequest(opt SendRequestOptions) (map[string]interface{}, error)

func ServiceUsageInternalError160009

func ServiceUsageInternalError160009(err error) (bool, string)

See https://github.com/hashicorp/terraform-provider-google/issues/14691 for details on the error message this handles This is a post-operation error so it uses tpgresource.CommonOpError instead of googleapi.Error

func ServiceUsageServiceBeingActivated

func ServiceUsageServiceBeingActivated(err error) (bool, string)

Retry if service usage decides you're activating the same service multiple times. This can happen if a service and a dependent service aren't batched together- eg container.googleapis.com in one request followed by compute.g.c in the next (container relies on compute and implicitly activates it)

func ValidateCustomEndpoint

func ValidateCustomEndpoint(v interface{}, k string) (ws []string, errors []error)

Types

type BatchRequest

type BatchRequest struct {
	// ResourceName represents the underlying resource for which
	// a request is made. Its format is determined by what SendF expects, but
	// typically should be the name of the parent GCP resource being changed.
	ResourceName string

	// Body is this request's data to be passed to SendF, and may be combined
	// with other bodies using CombineF.
	Body interface{}

	// CombineF function determines how to combine bodies from two batches.
	CombineF BatcherCombineFunc

	// SendF function determines how to actually send a batched request to a
	// third party service. The arguments given to this function are
	// (ResourceName, Body) where Body may have been combined with other request
	// Bodies.
	SendF BatcherSendFunc

	// ID for debugging request. This should be specific to a single request
	// (i.e. per Terraform resource)
	DebugId string
}

BatchRequest represents a single request to a global batcher.

type BatcherCombineFunc

type BatcherCombineFunc func(body interface{}, toAdd interface{}) (interface{}, error)

BatcherCombineFunc is a function type for combine existing batches and additional batch data

type BatcherSendFunc

type BatcherSendFunc func(resourceName string, body interface{}) (interface{}, error)

BatcherSendFunc is a function type for sending a batch request

type BatchingConfig

type BatchingConfig struct {
	SendAfter      time.Duration
	EnableBatching bool
}

BatchingConfig contains user configuration for controlling batch requests.

func ExpandProviderBatchingConfig

func ExpandProviderBatchingConfig(v interface{}) (*BatchingConfig, error)

type BigtableClientFactory

type BigtableClientFactory struct {
	UserAgent           string
	TokenSource         oauth2.TokenSource
	BillingProject      string
	UserProjectOverride bool
	// contains filtered or unexported fields
}

func (BigtableClientFactory) NewAdminClient

func (s BigtableClientFactory) NewAdminClient(project, instance string) (*bigtable.AdminClient, error)

func (BigtableClientFactory) NewClient

func (s BigtableClientFactory) NewClient(project, instance string) (*bigtable.Client, error)

func (BigtableClientFactory) NewInstanceAdminClient

func (s BigtableClientFactory) NewInstanceAdminClient(project string) (*bigtable.InstanceAdminClient, error)

type Config

type Config struct {
	DCLConfig
	AccessToken                        string
	Credentials                        string
	ImpersonateServiceAccount          string
	ImpersonateServiceAccountDelegates []string
	Project                            string
	Region                             string
	BillingProject                     string
	Zone                               string
	Scopes                             []string
	BatchingConfig                     *BatchingConfig
	UserProjectOverride                bool
	RequestReason                      string
	RequestTimeout                     time.Duration
	// PollInterval is passed to resource.StateChangeConf in common_operation.go
	// It controls the interval at which we poll for successful operations
	PollInterval time.Duration

	Client    *http.Client
	Context   context.Context
	UserAgent string

	AccessApprovalBasePath           string
	AccessContextManagerBasePath     string
	ActiveDirectoryBasePath          string
	AlloydbBasePath                  string
	ApiGatewayBasePath               string
	ApigeeBasePath                   string
	AppEngineBasePath                string
	ArtifactRegistryBasePath         string
	BackupDRBasePath                 string
	BeyondcorpBasePath               string
	BiglakeBasePath                  string
	BigQueryBasePath                 string
	BigqueryAnalyticsHubBasePath     string
	BigqueryConnectionBasePath       string
	BigqueryDatapolicyBasePath       string
	BigqueryDataTransferBasePath     string
	BigqueryReservationBasePath      string
	BigtableBasePath                 string
	BillingBasePath                  string
	BinaryAuthorizationBasePath      string
	CertificateManagerBasePath       string
	CloudAssetBasePath               string
	CloudBuildBasePath               string
	Cloudbuildv2BasePath             string
	CloudFunctionsBasePath           string
	Cloudfunctions2BasePath          string
	CloudIdentityBasePath            string
	CloudIdsBasePath                 string
	CloudIotBasePath                 string
	CloudRunBasePath                 string
	CloudRunV2BasePath               string
	CloudSchedulerBasePath           string
	CloudTasksBasePath               string
	ComputeBasePath                  string
	ContainerAnalysisBasePath        string
	ContainerAttachedBasePath        string
	CoreBillingBasePath              string
	DatabaseMigrationServiceBasePath string
	DataCatalogBasePath              string
	DataformBasePath                 string
	DataFusionBasePath               string
	DataLossPreventionBasePath       string
	DataplexBasePath                 string
	DataprocBasePath                 string
	DataprocMetastoreBasePath        string
	DatastoreBasePath                string
	DatastreamBasePath               string
	DeploymentManagerBasePath        string
	DialogflowBasePath               string
	DialogflowCXBasePath             string
	DNSBasePath                      string
	DocumentAIBasePath               string
	DocumentAIWarehouseBasePath      string
	EssentialContactsBasePath        string
	FilestoreBasePath                string
	FirebaseBasePath                 string
	FirebaseDatabaseBasePath         string
	FirebaseExtensionsBasePath       string
	FirebaseHostingBasePath          string
	FirebaseStorageBasePath          string
	FirestoreBasePath                string
	GameServicesBasePath             string
	GKEBackupBasePath                string
	GKEHubBasePath                   string
	GKEHub2BasePath                  string
	GkeonpremBasePath                string
	HealthcareBasePath               string
	IAM2BasePath                     string
	IAMBetaBasePath                  string
	IAMWorkforcePoolBasePath         string
	IapBasePath                      string
	IdentityPlatformBasePath         string
	KMSBasePath                      string
	LoggingBasePath                  string
	LookerBasePath                   string
	MemcacheBasePath                 string
	MLEngineBasePath                 string
	MonitoringBasePath               string
	NetworkConnectivityBasePath      string
	NetworkManagementBasePath        string
	NetworkSecurityBasePath          string
	NetworkServicesBasePath          string
	NotebooksBasePath                string
	OrgPolicyBasePath                string
	OSConfigBasePath                 string
	OSLoginBasePath                  string
	PrivatecaBasePath                string
	PublicCABasePath                 string
	PubsubBasePath                   string
	PubsubLiteBasePath               string
	RedisBasePath                    string
	ResourceManagerBasePath          string
	RuntimeConfigBasePath            string
	SecretManagerBasePath            string
	SecurityCenterBasePath           string
	SecurityScannerBasePath          string
	ServiceDirectoryBasePath         string
	ServiceManagementBasePath        string
	ServiceUsageBasePath             string
	SourceRepoBasePath               string
	SpannerBasePath                  string
	SQLBasePath                      string
	StorageBasePath                  string
	StorageTransferBasePath          string
	TagsBasePath                     string
	TPUBasePath                      string
	VertexAIBasePath                 string
	VmwareengineBasePath             string
	VPCAccessBasePath                string
	WorkflowsBasePath                string
	WorkstationsBasePath             string

	CloudBillingBasePath      string
	ComposerBasePath          string
	ContainerBasePath         string
	DataflowBasePath          string
	IamCredentialsBasePath    string
	ResourceManagerV3BasePath string
	IAMBasePath               string
	CloudIoTBasePath          string
	ServiceNetworkingBasePath string
	BigtableAdminBasePath     string
	TagsLocationBasePath      string

	// dcl
	ContainerAwsBasePath   string
	ContainerAzureBasePath string

	RequestBatcherServiceUsage *RequestBatcher
	RequestBatcherIam          *RequestBatcher
	// contains filtered or unexported fields
}

Config is the configuration structure used to instantiate the Google provider.

func (*Config) BigTableClientFactory

func (c *Config) BigTableClientFactory(userAgent string) *BigtableClientFactory

func (*Config) GetCredentials

func (c *Config) GetCredentials(clientScopes []string, initialCredentialsOnly bool) (googleoauth.Credentials, error)

Get a set of credentials with a given scope (clientScopes) based on the Config object. If initialCredentialsOnly is true, don't follow the impersonation settings and return the initial set of creds instead.

func (*Config) LoadAndValidate

func (c *Config) LoadAndValidate(ctx context.Context) error

func (*Config) NewAppEngineClient

func (c *Config) NewAppEngineClient(userAgent string) *appengine.APIService

func (*Config) NewBigQueryClient

func (c *Config) NewBigQueryClient(userAgent string) *bigquery.Service

func (*Config) NewBigTableProjectsInstancesClient

func (c *Config) NewBigTableProjectsInstancesClient(userAgent string) *bigtableadmin.ProjectsInstancesService

Unlike other clients, the Bigtable Admin client doesn't use a single service. Instead, there are several distinct services created off the base service object. To imitate most other handwritten clients, we expose those directly instead of providing the `Service` object as a factory.

func (*Config) NewBigTableProjectsInstancesTablesClient

func (c *Config) NewBigTableProjectsInstancesTablesClient(userAgent string) *bigtableadmin.ProjectsInstancesTablesService

func (*Config) NewBillingClient

func (c *Config) NewBillingClient(userAgent string) *cloudbilling.APIService

func (*Config) NewBuildClient

func (c *Config) NewBuildClient(userAgent string) *cloudbuild.Service

func (*Config) NewCloudFunctionsClient

func (c *Config) NewCloudFunctionsClient(userAgent string) *cloudfunctions.Service

func (*Config) NewCloudIdentityClient

func (c *Config) NewCloudIdentityClient(userAgent string) *cloudidentity.Service

func (*Config) NewCloudIoTClient

func (c *Config) NewCloudIoTClient(userAgent string) *cloudiot.Service

func (*Config) NewCloudRunV2Client

func (c *Config) NewCloudRunV2Client(userAgent string) *runadminv2.Service

func (*Config) NewComposerClient

func (c *Config) NewComposerClient(userAgent string) *composer.Service

func (*Config) NewComputeClient

func (c *Config) NewComputeClient(userAgent string) *compute.Service

Methods to create new services from config Some base paths below need the version and possibly more of the path set on them. The client libraries are inconsistent about which values they need; while most only want the host URL, some older ones also want the version and some of those "projects" as well. You can find out if this is required by looking at the basePath value in the client library file.

func (*Config) NewContainerClient

func (c *Config) NewContainerClient(userAgent string) *container.Service

func (*Config) NewDataflowClient

func (c *Config) NewDataflowClient(userAgent string) *dataflow.Service

func (*Config) NewDataprocClient

func (c *Config) NewDataprocClient(userAgent string) *dataproc.Service

func (*Config) NewDnsClient

func (c *Config) NewDnsClient(userAgent string) *dns.Service

func (*Config) NewHealthcareClient

func (c *Config) NewHealthcareClient(userAgent string) *healthcare.Service

func (*Config) NewIamClient

func (c *Config) NewIamClient(userAgent string) *iam.Service

func (*Config) NewIamCredentialsClient

func (c *Config) NewIamCredentialsClient(userAgent string) *iamcredentials.Service

func (*Config) NewKmsClient

func (c *Config) NewKmsClient(userAgent string) *cloudkms.Service

func (*Config) NewKmsClientWithCtx

func (c *Config) NewKmsClientWithCtx(ctx context.Context, userAgent string) *cloudkms.Service

func (*Config) NewLoggingClient

func (c *Config) NewLoggingClient(userAgent string) *cloudlogging.Service

func (*Config) NewPubsubClient

func (c *Config) NewPubsubClient(userAgent string) *pubsub.Service

func (*Config) NewResourceManagerClient

func (c *Config) NewResourceManagerClient(userAgent string) *cloudresourcemanager.Service

func (*Config) NewResourceManagerV3Client

func (c *Config) NewResourceManagerV3Client(userAgent string) *resourceManagerV3.Service

func (*Config) NewRuntimeconfigClient

func (c *Config) NewRuntimeconfigClient(userAgent string) *runtimeconfig.Service

func (*Config) NewServiceManClient

func (c *Config) NewServiceManClient(userAgent string) *servicemanagement.APIService

func (*Config) NewServiceNetworkingClient

func (c *Config) NewServiceNetworkingClient(userAgent string) *servicenetworking.APIService

func (*Config) NewServiceUsageClient

func (c *Config) NewServiceUsageClient(userAgent string) *serviceusage.Service

func (*Config) NewSourceRepoClient

func (c *Config) NewSourceRepoClient(userAgent string) *sourcerepo.Service

func (*Config) NewSpannerClient

func (c *Config) NewSpannerClient(userAgent string) *spanner.Service

func (*Config) NewSqlAdminClient

func (c *Config) NewSqlAdminClient(userAgent string) *sqladmin.Service

func (*Config) NewStorageClient

func (c *Config) NewStorageClient(userAgent string) *storage.Service

func (*Config) NewStorageClientWithTimeoutOverride

func (c *Config) NewStorageClientWithTimeoutOverride(userAgent string, timeout time.Duration) *storage.Service

For object uploads, we need to override the specific timeout because they are long, synchronous operations.

func (*Config) NewStorageTransferClient

func (c *Config) NewStorageTransferClient(userAgent string) *storagetransfer.Service

type DCLConfig

type DCLConfig struct {
	ApikeysBasePath              string
	AssuredWorkloadsBasePath     string
	CloudBuildWorkerPoolBasePath string
	ClouddeployBasePath          string
	CloudResourceManagerBasePath string
	EventarcBasePath             string
	FirebaserulesBasePath        string
	GKEHubFeatureBasePath        string
	NetworkConnectivityBasePath  string
	RecaptchaEnterpriseBasePath  string
}

type Formatter

type Formatter struct {
	TimestampFormat string
	LogFormat       string
}

type MutexKV

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

MutexKV is a simple key/value store for arbitrary mutexes. It can be used to serialize changes across arbitrary collaborators that share knowledge of the keys they must serialize on.

The initial use case is to let aws_security_group_rule resources serialize their access to individual security groups based on SG ID.

func NewMutexKV

func NewMutexKV() *MutexKV

Returns a properly initialized MutexKV

func (*MutexKV) Lock

func (m *MutexKV) Lock(key string)

Locks the mutex for the given key. Caller is responsible for calling Unlock for the same key

func (*MutexKV) RLock

func (m *MutexKV) RLock(key string)

Acquires a read-lock on the mutex for the given key. Caller is responsible for calling RUnlock for the same key

func (*MutexKV) RUnlock

func (m *MutexKV) RUnlock(key string)

Releases a read-lock on the mutex for the given key. Caller must have called RLock for the same key first

func (*MutexKV) Unlock

func (m *MutexKV) Unlock(key string)

Unlock the mutex for the given key. Caller must have called Lock for the same key first

type PollCheckResponseFunc

type PollCheckResponseFunc func(resp map[string]interface{}, respErr error) PollResult

Function to check the response from polling once

type PollReadFunc

type PollReadFunc func() (resp map[string]interface{}, respErr error)

Function handling for polling for a resource

type PollResult

type PollResult *resource.RetryError

func ErrorPollResult

func ErrorPollResult(err error) PollResult

Helper functions to construct result of single pollRead as return result for a PollCheckResponseFunc

func PendingStatusPollResult

func PendingStatusPollResult(status string) PollResult

func PollCheckForAbsence

func PollCheckForAbsence(_ map[string]interface{}, respErr error) PollResult

PollCheckForAbsence waits for a 404 response, continues polling on a successful response, and returns any other error.

func PollCheckForAbsenceWith403

func PollCheckForAbsenceWith403(_ map[string]interface{}, respErr error) PollResult

PollCheckForAbsence waits for a 404/403 response, continues polling on a successful response, and returns any other error.

func PollCheckForExistence

func PollCheckForExistence(_ map[string]interface{}, respErr error) PollResult

PollCheckForExistence waits for a successful response, continues polling on 404, and returns any other error.

func PollCheckForExistenceWith403

func PollCheckForExistenceWith403(_ map[string]interface{}, respErr error) PollResult

PollCheckForExistenceWith403 waits for a successful response, continues polling on 404 or 403, and returns any other error.

func SuccessPollResult

func SuccessPollResult() PollResult

type ProviderMeta

type ProviderMeta struct {
	ModuleName string `cty:"module_name"`
}

type RequestBatcher

type RequestBatcher struct {
	sync.Mutex

	*BatchingConfig
	// contains filtered or unexported fields
}

RequestBatcher keeps track of batched requests globally. It should be created at a provider level. In general, one should be created per service that requires batching to:

  • prevent blocking batching for one service due to another,
  • minimize the possibility of overlap in batchKey formats (see SendRequestWithTimeout)

func NewRequestBatcher

func NewRequestBatcher(debugId string, ctx context.Context, config *BatchingConfig) *RequestBatcher

Initializes a new batcher.

func (*RequestBatcher) SendRequestWithTimeout

func (b *RequestBatcher) SendRequestWithTimeout(batchKey string, request *BatchRequest, timeout time.Duration) (interface{}, error)

SendRequestWithTimeout is a blocking call for making a single request, run alone or as part of a batch. It manages registering the single request with the batcher and waiting on the result.

Params: batchKey: A string to group batchable requests. It should be unique to the API request being sent, similar to the HTTP request URL with GCP resource ID included in the URL (the caller may choose to use a key with method if needed to diff GET/read and POST/create)

As an example, for google_project_service, the batcher is called to batch services.batchEnable() calls for a project $PROJECT. The calling code uses the template "serviceusage:projects/$PROJECT/services:batchEnable", which mirrors the HTTP request: POST https://serviceusage.googleapis.com/v1/projects/$PROJECT/services:batchEnable

type RetryErrorPredicateFunc

type RetryErrorPredicateFunc func(error) (bool, string)

func IsNotFoundRetryableError

func IsNotFoundRetryableError(opType string) RetryErrorPredicateFunc

Retry if getting a resource/operation returns a 404 for specific operations. opType should describe the operation for which 404 can be retryable.

type RetryOptions

type RetryOptions struct {
	RetryFunc            func() error
	Timeout              time.Duration
	PollInterval         time.Duration
	ErrorRetryPredicates []RetryErrorPredicateFunc
	ErrorAbortPredicates []RetryErrorPredicateFunc
}

type SendRequestOptions

type SendRequestOptions struct {
	Config               *Config
	Method               string
	Project              string
	RawURL               string
	UserAgent            string
	Body                 map[string]any
	Timeout              time.Duration
	ErrorRetryPredicates []RetryErrorPredicateFunc
	ErrorAbortPredicates []RetryErrorPredicateFunc
}

type StaticTokenSource

type StaticTokenSource struct {
	oauth2.TokenSource
}

StaticTokenSource is used to be able to identify static token sources without reflection.

type TimeoutError

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

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

func (*TimeoutError) Timeout

func (e *TimeoutError) Timeout() bool

Jump to

Keyboard shortcuts

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