diff --git a/.changelog/8720.txt b/.changelog/8720.txt new file mode 100644 index 00000000000..8ec013c0699 --- /dev/null +++ b/.changelog/8720.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google/acctest/bootstrap_iam_test_utils.go b/google/acctest/bootstrap_iam_test_utils.go index 81af4f8fefd..e7bf9edb89c 100644 --- a/google/acctest/bootstrap_iam_test_utils.go +++ b/google/acctest/bootstrap_iam_test_utils.go @@ -94,11 +94,3 @@ func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) b func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool { return BootstrapPSARoles(t, prefix, agentName, []string{role}) } - -// Returns the bindings that are in the first set of bindings but not the second. -// -// Deprecated: For backward compatibility missingBindings is still working, -// but all new code should use MissingBindings in the tpgiamresource package instead. -func missingBindings(a, b []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { - return tpgiamresource.MissingBindings(a, b) -} diff --git a/google/acctest/gcp_sweeper.go b/google/acctest/gcp_sweeper.go deleted file mode 100644 index e0a8a5d4b58..00000000000 --- a/google/acctest/gcp_sweeper.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package acctest - -import ( - "github.com/hashicorp/terraform-provider-google/google/sweeper" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// SharedConfigForRegion returns a common config setup needed for the sweeper -// functions for a given region -// -// Deprecated: For backward compatibility SharedConfigForRegion is still working, -// but all new code should use SharedConfigForRegion in the sweeper package instead. -func SharedConfigForRegion(region string) (*transport_tpg.Config, error) { - return sweeper.SharedConfigForRegion(region) -} - -// Deprecated: For backward compatibility IsSweepableTestResource is still working, -// but all new code should use IsSweepableTestResource in the sweeper package instead. -func IsSweepableTestResource(resourceName string) bool { - return sweeper.IsSweepableTestResource(resourceName) -} diff --git a/google/acctest/provider_test_utils.go b/google/acctest/provider_test_utils.go index af45adbb7f7..045f6517204 100644 --- a/google/acctest/provider_test_utils.go +++ b/google/acctest/provider_test_utils.go @@ -20,86 +20,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -// Deprecated: For backward compatibility TestEnvVar is still working, -// but all new code should use TestEnvVar in the envvar package instead. -const TestEnvVar = envvar.TestEnvVar - -// Deprecated: For backward compatibility CredsEnvVars is still working, -// but all new code should use CredsEnvVars in the envvar package instead. -var CredsEnvVars = envvar.CredsEnvVars - -// Deprecated: For backward compatibility ProjectNumberEnvVars is still working, -// but all new code should use ProjectNumberEnvVars in the envvar package instead. -var ProjectNumberEnvVars = envvar.ProjectNumberEnvVars - -// Deprecated: For backward compatibility ProjectEnvVars is still working, -// but all new code should use ProjectEnvVars in the envvar package instead. -var ProjectEnvVars = envvar.ProjectEnvVars - -// Deprecated: For backward compatibility FirestoreProjectEnvVars is still working, -// but all new code should use FirestoreProjectEnvVars in the envvar package instead. -var FirestoreProjectEnvVars = envvar.FirestoreProjectEnvVars - -// Deprecated: For backward compatibility RegionEnvVars is still working, -// but all new code should use RegionEnvVars in the envvar package instead. -var RegionEnvVars = envvar.RegionEnvVars - -// Deprecated: For backward compatibility ZoneEnvVars is still working, -// but all new code should use ZoneEnvVars in the envvar package instead. -var ZoneEnvVars = envvar.ZoneEnvVars - -// Deprecated: For backward compatibility OrgEnvVars is still working, -// but all new code should use OrgEnvVars in the envvar package instead. -var OrgEnvVars = envvar.OrgEnvVars - -// This value is the Customer ID of the GOOGLE_ORG_DOMAIN workspace. -// See https://admin.google.com/ac/accountsettings when logged into an org admin for the value. -// -// Deprecated: For backward compatibility CustIdEnvVars is still working, -// but all new code should use CustIdEnvVars in the envvar package instead. -var CustIdEnvVars = envvar.CustIdEnvVars - -// This value is the username of an identity account within the GOOGLE_ORG_DOMAIN workspace. -// For example in the org example.com with a user "foo@example.com", this would be set to "foo". -// See https://admin.google.com/ac/users when logged into an org admin for a list. -// -// Deprecated: For backward compatibility IdentityUserEnvVars is still working, -// but all new code should use IdentityUserEnvVars in the envvar package instead. -var IdentityUserEnvVars = envvar.IdentityUserEnvVars - -// Deprecated: For backward compatibility OrgEnvDomainVars is still working, -// but all new code should use OrgEnvDomainVars in the envvar package instead. -var OrgEnvDomainVars = envvar.OrgEnvDomainVars - -// Deprecated: For backward compatibility ServiceAccountEnvVars is still working, -// but all new code should use ServiceAccountEnvVars in the envvar package instead. -var ServiceAccountEnvVars = envvar.ServiceAccountEnvVars - -// Deprecated: For backward compatibility OrgTargetEnvVars is still working, -// but all new code should use OrgTargetEnvVars in the envvar package instead. -var OrgTargetEnvVars = envvar.OrgTargetEnvVars - -// This is the billing account that will be charged for the infrastructure used during testing. For -// that reason, it is also the billing account used for creating new projects. -// -// Deprecated: For backward compatibility BillingAccountEnvVars is still working, -// but all new code should use BillingAccountEnvVars in the envvar package instead. -var BillingAccountEnvVars = envvar.BillingAccountEnvVars - -// This is the billing account that will be modified to test billing-related functionality. It is -// expected to have more permissions granted to the test user and support subaccounts. -// -// Deprecated: For backward compatibility MasterBillingAccountEnvVars is still working, -// but all new code should use MasterBillingAccountEnvVars in the envvar package instead. -var MasterBillingAccountEnvVars = envvar.MasterBillingAccountEnvVars - -// This value is the description used for test PublicAdvertisedPrefix setup to avoid required DNS -// setup. This is only used during integration tests and would be invalid to surface to users -// -// Deprecated: For backward compatibility PapDescriptionEnvVars is still working, -// but all new code should use PapDescriptionEnvVars in the envvar package instead. -var PapDescriptionEnvVars = envvar.PapDescriptionEnvVars - var TestAccProviders map[string]*schema.Provider var testAccProvider *schema.Provider @@ -136,20 +56,20 @@ func AccTestPreCheck(t *testing.T) { os.Setenv("GOOGLE_CREDENTIALS", string(creds)) } - if v := transport_tpg.MultiEnvSearch(CredsEnvVars); v == "" { - t.Fatalf("One of %s must be set for acceptance tests", strings.Join(CredsEnvVars, ", ")) + if v := transport_tpg.MultiEnvSearch(envvar.CredsEnvVars); v == "" { + t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.CredsEnvVars, ", ")) } - if v := transport_tpg.MultiEnvSearch(ProjectEnvVars); v == "" { - t.Fatalf("One of %s must be set for acceptance tests", strings.Join(ProjectEnvVars, ", ")) + if v := transport_tpg.MultiEnvSearch(envvar.ProjectEnvVars); v == "" { + t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.ProjectEnvVars, ", ")) } - if v := transport_tpg.MultiEnvSearch(RegionEnvVars); v == "" { - t.Fatalf("One of %s must be set for acceptance tests", strings.Join(RegionEnvVars, ", ")) + if v := transport_tpg.MultiEnvSearch(envvar.RegionEnvVars); v == "" { + t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.RegionEnvVars, ", ")) } - if v := transport_tpg.MultiEnvSearch(ZoneEnvVars); v == "" { - t.Fatalf("One of %s must be set for acceptance tests", strings.Join(ZoneEnvVars, ", ")) + if v := transport_tpg.MultiEnvSearch(envvar.ZoneEnvVars); v == "" { + t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.ZoneEnvVars, ", ")) } } @@ -175,125 +95,6 @@ func GetTestProject(is *terraform.InstanceState, config *transport_tpg.Config) ( return "", fmt.Errorf("%q: required field is not set", "project") } -// AccTestPreCheck ensures at least one of the project env variables is set. -// -// Deprecated: For backward compatibility GetTestProjectNumberFromEnv is still working, -// but all new code should use GetTestProjectNumberFromEnv in the envvar package instead. -func GetTestProjectNumberFromEnv() string { - return envvar.GetTestProjectNumberFromEnv() -} - -// AccTestPreCheck ensures at least one of the project env variables is set. -// -// Deprecated: For backward compatibility GetTestProjectFromEnv is still working, -// but all new code should use GetTestProjectFromEnv in the envvar package instead. -func GetTestProjectFromEnv() string { - return envvar.GetTestProjectFromEnv() -} - -// AccTestPreCheck ensures at least one of the credentials env variables is set. -// -// Deprecated: For backward compatibility GetTestCredsFromEnv is still working, -// but all new code should use GetTestCredsFromEnv in the envvar package instead. -func GetTestCredsFromEnv() string { - return envvar.GetTestCredsFromEnv() -} - -// AccTestPreCheck ensures at least one of the region env variables is set. -// -// Deprecated: For backward compatibility GetTestRegionFromEnv is still working, -// but all new code should use GetTestRegionFromEnv in the envvar package instead. -func GetTestRegionFromEnv() string { - return envvar.GetTestRegionFromEnv() -} - -// Deprecated: For backward compatibility GetTestZoneFromEnv is still working, -// but all new code should use GetTestZoneFromEnv in the envvar package instead. -func GetTestZoneFromEnv() string { - return envvar.GetTestZoneFromEnv() -} - -// Deprecated: For backward compatibility GetTestCustIdFromEnv is still working, -// but all new code should use GetTestCustIdFromEnv in the envvar package instead. -func GetTestCustIdFromEnv(t *testing.T) string { - return envvar.GetTestCustIdFromEnv(t) -} - -// Deprecated: For backward compatibility GetTestIdentityUserFromEnv is still working, -// but all new code should use GetTestIdentityUserFromEnv in the envvar package instead. -func GetTestIdentityUserFromEnv(t *testing.T) string { - return envvar.GetTestIdentityUserFromEnv(t) -} - -// Firestore can't be enabled at the same time as Datastore, so we need a new -// project to manage it until we can enable Firestore programmatically. -// -// Deprecated: For backward compatibility GetTestFirestoreProjectFromEnv is still working, -// but all new code should use GetTestFirestoreProjectFromEnv in the envvar package instead. -func GetTestFirestoreProjectFromEnv(t *testing.T) string { - return envvar.GetTestFirestoreProjectFromEnv(t) -} - -// Returns the raw organization id like 1234567890, skipping the test if one is -// not found. -// -// Deprecated: For backward compatibility GetTestOrgFromEnv is still working, -// but all new code should use GetTestOrgFromEnv in the envvar package instead. -func GetTestOrgFromEnv(t *testing.T) string { - return envvar.GetTestOrgFromEnv(t) -} - -// Alternative to GetTestOrgFromEnv that doesn't need *testing.T -// If using this, you need to process unset values at the call site -// -// Deprecated: For backward compatibility UnsafeGetTestOrgFromEnv is still working, -// but all new code should use UnsafeGetTestOrgFromEnv in the envvar package instead. -func UnsafeGetTestOrgFromEnv() string { - return envvar.UnsafeGetTestOrgFromEnv() -} - -// Deprecated: For backward compatibility GetTestOrgDomainFromEnv is still working, -// but all new code should use GetTestOrgDomainFromEnv in the envvar package instead. -func GetTestOrgDomainFromEnv(t *testing.T) string { - return envvar.GetTestOrgDomainFromEnv(t) -} - -// Deprecated: For backward compatibility GetTestOrgTargetFromEnv is still working, -// but all new code should use GetTestOrgTargetFromEnv in the envvar package instead. -func GetTestOrgTargetFromEnv(t *testing.T) string { - return envvar.GetTestOrgTargetFromEnv(t) -} - -// This is the billing account that will be charged for the infrastructure used during testing. For -// that reason, it is also the billing account used for creating new projects. -// -// Deprecated: For backward compatibility GetTestBillingAccountFromEnv is still working, -// but all new code should use GetTestBillingAccountFromEnv in the envvar package instead. -func GetTestBillingAccountFromEnv(t *testing.T) string { - return envvar.GetTestBillingAccountFromEnv(t) -} - -// This is the billing account that will be modified to test billing-related functionality. It is -// expected to have more permissions granted to the test user and support subaccounts. -// -// Deprecated: For backward compatibility GetTestMasterBillingAccountFromEnv is still working, -// but all new code should use GetTestMasterBillingAccountFromEnv in the envvar package instead. -func GetTestMasterBillingAccountFromEnv(t *testing.T) string { - return envvar.GetTestMasterBillingAccountFromEnv(t) -} - -// Deprecated: For backward compatibility GetTestServiceAccountFromEnv is still working, -// but all new code should use GetTestServiceAccountFromEnv in the envvar package instead. -func GetTestServiceAccountFromEnv(t *testing.T) string { - return envvar.GetTestServiceAccountFromEnv(t) -} - -// Deprecated: For backward compatibility GetTestPublicAdvertisedPrefixDescriptionFromEnv is still working, -// but all new code should use GetTestPublicAdvertisedPrefixDescriptionFromEnv in the envvar package instead. -func GetTestPublicAdvertisedPrefixDescriptionFromEnv(t *testing.T) string { - return envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t) -} - // Some tests fail during VCR. One common case is race conditions when creating resources. // If a test config adds two fine-grained resources with the same parent it is undefined // which will be created first, causing VCR to fail ~50% of the time @@ -309,9 +110,3 @@ func SleepInSecondsForTest(t int) resource.TestCheckFunc { return nil } } - -// Deprecated: For backward compatibility SkipIfEnvNotSet is still working, -// but all new code should use SkipIfEnvNotSet in the envvar package instead. -func SkipIfEnvNotSet(t *testing.T, envs ...string) { - envvar.SkipIfEnvNotSet(t, envs...) -} diff --git a/google/appengine_operation.go b/google/appengine_operation.go deleted file mode 100644 index cbe4c936386..00000000000 --- a/google/appengine_operation.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/appengine" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility AppEngineOperationWaitTimeWithResponse is still working, -// but all new code should use AppEngineOperationWaitTimeWithResponse in the appengine package instead. -func AppEngineOperationWaitTimeWithResponse(config *transport_tpg.Config, res interface{}, response *map[string]interface{}, appId, activity, userAgent string, timeout time.Duration) error { - return appengine.AppEngineOperationWaitTimeWithResponse(config, res, response, appId, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility AppEngineOperationWaitTime is still working, -// but all new code should use AppEngineOperationWaitTime in the appengine package instead. -func AppEngineOperationWaitTime(config *transport_tpg.Config, res interface{}, appId, activity, userAgent string, timeout time.Duration) error { - return appengine.AppEngineOperationWaitTime(config, res, appId, activity, userAgent, timeout) -} diff --git a/google/bootstrap_iam_test_utils.go b/google/bootstrap_iam_test_utils.go deleted file mode 100644 index 719e24c02f1..00000000000 --- a/google/bootstrap_iam_test_utils.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "testing" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" -) - -// BootstrapAllPSARoles ensures that the given project's IAM -// policy grants the given service agents the given roles. -// prefix is usually "service-" and indicates the service agent should have the -// given prefix before the project number. -// This is important to bootstrap because using iam policy resources means that -// deleting them removes permissions for concurrent tests. -// Return whether the bindings changed. -func BootstrapAllPSARoles(t *testing.T, prefix string, agentNames, roles []string) bool { - return acctest.BootstrapAllPSARoles(t, prefix, agentNames, roles) -} - -// BootstrapAllPSARole is a version of BootstrapAllPSARoles for granting a -// single role to multiple service agents. -func BootstrapAllPSARole(t *testing.T, prefix string, agentNames []string, role string) bool { - return acctest.BootstrapAllPSARole(t, prefix, agentNames, role) -} - -// BootstrapPSARoles is a version of BootstrapAllPSARoles for granting roles to -// a single service agent. -func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) bool { - return acctest.BootstrapPSARoles(t, prefix, agentName, roles) -} - -// BootstrapPSARole is a simplified version of BootstrapPSARoles for granting a -// single role to a single service agent. -func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool { - return acctest.BootstrapPSARole(t, prefix, agentName, role) -} - -// Returns the bindings that are in the first set of bindings but not the second. -// -// Deprecated: For backward compatibility missingBindings is still working, -// but all new code should use MissingBindings in the tpgiamresource package instead. -func missingBindings(a, b []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { - return tpgiamresource.MissingBindings(a, b) -} diff --git a/google/bootstrap_test_utils.go b/google/bootstrap_test_utils.go deleted file mode 100644 index 86c5ec33281..00000000000 --- a/google/bootstrap_test_utils.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "testing" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" -) - -type BootstrappedKMS = acctest.BootstrappedKMS - -func BootstrapKMSKey(t *testing.T) acctest.BootstrappedKMS { - return acctest.BootstrapKMSKey(t) -} - -func BootstrapKMSKeyInLocation(t *testing.T, locationID string) acctest.BootstrappedKMS { - return acctest.BootstrapKMSKeyInLocation(t, locationID) -} - -// BootstrapKMSKeyWithPurpose returns a KMS key in the "global" location. -// See BootstrapKMSKeyWithPurposeInLocation. -func BootstrapKMSKeyWithPurpose(t *testing.T, purpose string) acctest.BootstrappedKMS { - return acctest.BootstrapKMSKeyWithPurpose(t, purpose) -} - -/** -* BootstrapKMSKeyWithPurposeInLocation will return a KMS key in a -* particular location with the given purpose that can be used -* in tests that are testing KMS integration with other resources. -* -* This will either return an existing key or create one if it hasn't been created -* in the project yet. The motivation is because keyrings don't get deleted and we -* don't want a linear growth of disabled keyrings in a project. We also don't want -* to incur the overhead of creating a new project for each test that needs to use -* a KMS key. -**/ -func BootstrapKMSKeyWithPurposeInLocation(t *testing.T, purpose, locationID string) acctest.BootstrappedKMS { - return acctest.BootstrapKMSKeyWithPurposeInLocation(t, purpose, locationID) -} - -func BootstrapKMSKeyWithPurposeInLocationAndName(t *testing.T, purpose, locationID, keyShortName string) acctest.BootstrappedKMS { - return acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, purpose, locationID, keyShortName) -} - -func BootstrapServiceAccount(t *testing.T, project, testRunner string) string { - return acctest.BootstrapServiceAccount(t, project, testRunner) -} - -func BootstrapSharedTestADDomain(t *testing.T, testId string, networkName string) string { - return acctest.BootstrapSharedTestADDomain(t, testId, networkName) -} - -// BootstrapSharedTestNetwork will return a persistent compute network for a -// test or set of tests. -// -// Resources like service_networking_connection use a consumer network and -// create a complementing tenant network which we don't control. These tenant -// networks never get cleaned up and they can accumulate to the point where a -// limit is reached for the organization. By reusing a consumer network across -// test runs, we can reduce the number of tenant networks that are needed. -// See b/146351146 for more context. -// -// testId specifies the test for which a shared network is used/initialized. -// Note that if the network is being used for a service_networking_connection, -// the same testId should generally not be used across tests, to avoid race -// conditions where multiple tests attempt to modify the connection at once. -// -// Returns the name of a network, creating it if it hasn't been created in the -// test project. -func BootstrapSharedTestNetwork(t *testing.T, testId string) string { - return acctest.BootstrapSharedTestNetwork(t, testId) -} - -func BootstrapServicePerimeterProjects(t *testing.T, desiredProjects int) []*cloudresourcemanager.Project { - return acctest.BootstrapServicePerimeterProjects(t, desiredProjects) -} - -func RemoveContainerServiceAgentRoleFromContainerEngineRobot(t *testing.T, project *cloudresourcemanager.Project) { - acctest.RemoveContainerServiceAgentRoleFromContainerEngineRobot(t, project) -} - -// BootstrapProject will create or get a project named -// "" that will persist across test runs, -// where projectIDSuffix is based off of getTestProjectFromEnv(). The reason -// for the naming is to isolate bootstrapped projects by test environment. -// Given the existing projects being used by our team, the prefix provided to -// this function can be no longer than 18 characters. -func BootstrapProject(t *testing.T, projectIDPrefix, billingAccount string, services []string) *cloudresourcemanager.Project { - return acctest.BootstrapProject(t, projectIDPrefix, billingAccount, services) -} - -// BootstrapConfig returns a Config pulled from the environment. -func BootstrapConfig(t *testing.T) *transport_tpg.Config { - return acctest.BootstrapConfig(t) -} - -// BootstrapSharedSQLInstanceBackupRun will return a shared SQL db instance that -// has a backup created for it. -func BootstrapSharedSQLInstanceBackupRun(t *testing.T) string { - return acctest.BootstrapSharedSQLInstanceBackupRun(t) -} - -func BootstrapSharedCaPoolInLocation(t *testing.T, location string) string { - return acctest.BootstrapSharedCaPoolInLocation(t, location) -} - -func BootstrapSubnet(t *testing.T, subnetName string, networkName string) string { - return acctest.BootstrapSubnet(t, subnetName, networkName) -} - -func BootstrapNetworkAttachment(t *testing.T, networkAttachmentName string, subnetName string) string { - return acctest.BootstrapNetworkAttachment(t, networkAttachmentName, subnetName) -} - -func setupProjectsAndGetAccessToken(org, billing, pid, service string, config *transport_tpg.Config) (string, error) { - return acctest.SetupProjectsAndGetAccessToken(org, billing, pid, service, config) -} diff --git a/google/cloudfunctions_operation.go b/google/cloudfunctions_operation.go deleted file mode 100644 index bd860cf6e46..00000000000 --- a/google/cloudfunctions_operation.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - tpgcloudfunctions "github.com/hashicorp/terraform-provider-google/google/services/cloudfunctions" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "google.golang.org/api/cloudfunctions/v1" -) - -// Deprecated: For backward compatibility cloudFunctionsOperationWait is still working, -// but all new code should use CloudFunctionsOperationWait in the tpgcloudfunctions package instead. -func cloudFunctionsOperationWait(config *transport_tpg.Config, op *cloudfunctions.Operation, activity, userAgent string, timeout time.Duration) error { - return tpgcloudfunctions.CloudFunctionsOperationWait(config, op, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility IsCloudFunctionsSourceCodeError is still working, -// but all new code should use IsCloudFunctionsSourceCodeError in the tpgcloudfunctions package instead. -func IsCloudFunctionsSourceCodeError(err error) (bool, string) { - return tpgcloudfunctions.IsCloudFunctionsSourceCodeError(err) -} diff --git a/google/cloudrun_polling.go b/google/cloudrun_polling.go deleted file mode 100644 index 5f7bf0dcdb7..00000000000 --- a/google/cloudrun_polling.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/cloudrun" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility PollCheckKnativeStatusFunc is still working, -// but all new code should use PollCheckKnativeStatusFunc in the cloudrun package instead. -func PollCheckKnativeStatusFunc(knativeRestResponse map[string]interface{}) func(resp map[string]interface{}, respErr error) transport_tpg.PollResult { - return cloudrun.PollCheckKnativeStatusFunc(knativeRestResponse) -} diff --git a/google/common_diff_suppress.go b/google/common_diff_suppress.go deleted file mode 100644 index 5849e3034c3..00000000000 --- a/google/common_diff_suppress.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -// Contains common diff suppress functions. - -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -// Deprecated: For backward compatibility OptionalPrefixSuppress is still working, -// but all new code should use OptionalPrefixSuppress in the tpgresource package instead. -func OptionalPrefixSuppress(prefix string) schema.SchemaDiffSuppressFunc { - return tpgresource.OptionalPrefixSuppress(prefix) -} - -// Deprecated: For backward compatibility IgnoreMissingKeyInMap is still working, -// but all new code should use IgnoreMissingKeyInMap in the tpgresource package instead. -func IgnoreMissingKeyInMap(key string) schema.SchemaDiffSuppressFunc { - return tpgresource.IgnoreMissingKeyInMap(key) -} - -// Deprecated: For backward compatibility OptionalSurroundingSpacesSuppress is still working, -// but all new code should use OptionalSurroundingSpacesSuppress in the tpgresource package instead. -func OptionalSurroundingSpacesSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.OptionalSurroundingSpacesSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility EmptyOrDefaultStringSuppress is still working, -// but all new code should use EmptyOrDefaultStringSuppress in the tpgresource package instead. -func EmptyOrDefaultStringSuppress(defaultVal string) schema.SchemaDiffSuppressFunc { - return tpgresource.EmptyOrDefaultStringSuppress(defaultVal) -} - -// Deprecated: For backward compatibility IpCidrRangeDiffSuppress is still working, -// but all new code should use IpCidrRangeDiffSuppress in the tpgresource package instead. -func IpCidrRangeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.IpCidrRangeDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility Sha256DiffSuppress is still working, -// but all new code should use Sha256DiffSuppress in the tpgresource package instead. -// Sha256DiffSuppress -// if old is the hex-encoded sha256 sum of new, treat them as equal -func Sha256DiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.Sha256DiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility CaseDiffSuppress is still working, -// but all new code should use CaseDiffSuppress in the tpgresource package instead. -func CaseDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.CaseDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility PortRangeDiffSuppress is still working, -// but all new code should use PortRangeDiffSuppress in the tpgresource package instead. -// Port range '80' and '80-80' is equivalent. -// `old` is read from the server and always has the full range format (e.g. '80-80', '1024-2048'). -// `new` can be either a single port or a port range. -func PortRangeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.PortRangeDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility Rfc3339TimeDiffSuppress is still working, -// but all new code should use Rfc3339TimeDiffSuppress in the tpgresource package instead. -// Single-digit hour is equivalent to hour with leading zero e.g. suppress diff 1:00 => 01:00. -// Assume either value could be in either format. -func Rfc3339TimeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.Rfc3339TimeDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility EmptyOrUnsetBlockDiffSuppress is still working, -// but all new code should use EmptyOrUnsetBlockDiffSuppress in the tpgresource package instead. -// Suppress diffs for blocks where one version is completely unset and the other is set -// to an empty block. This might occur in situations where removing a block completely -// is impossible (if it's computed or part of an AtLeastOneOf), so instead the user sets -// its values to empty. -// NOTE: Using Optional + Computed is *strongly* preferred to this DSF, as it's -// more well understood and resilient to API changes. -func EmptyOrUnsetBlockDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.EmptyOrUnsetBlockDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility EmptyOrUnsetBlockDiffSuppressLogic is still working, -// but all new code should use EmptyOrUnsetBlockDiffSuppressLogic in the tpgresource package instead. -// The core logic for EmptyOrUnsetBlockDiffSuppress, in a format that is more conducive -// to unit testing. -func EmptyOrUnsetBlockDiffSuppressLogic(k, old, new string, o, n interface{}) bool { - return tpgresource.EmptyOrUnsetBlockDiffSuppressLogic(k, old, new, o, n) -} - -// Deprecated: For backward compatibility LocationDiffSuppress is still working, -// but all new code should use LocationDiffSuppress in the tpgresource package instead. -// Suppress diffs for values that are equivalent except for their use of the words "location" -// compared to "region" or "zone" -func LocationDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.LocationDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility locationDiffSuppressHelper is still working, -// but all new code should use LocationDiffSuppressHelper in the tpgresource package instead. -func locationDiffSuppressHelper(a, b string) bool { - return tpgresource.LocationDiffSuppressHelper(a, b) -} - -// Deprecated: For backward compatibility AbsoluteDomainSuppress is still working, -// but all new code should use AbsoluteDomainSuppress in the tpgresource package instead. -// For managed SSL certs, if new is an absolute FQDN (trailing '.') but old isn't, treat them as equals. -func AbsoluteDomainSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.AbsoluteDomainSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility TimestampDiffSuppress is still working, -// but all new code should use TimestampDiffSuppress in the tpgresource package instead. -func TimestampDiffSuppress(format string) schema.SchemaDiffSuppressFunc { - return tpgresource.TimestampDiffSuppress(format) -} - -// Deprecated: For backward compatibility InternalIpDiffSuppress is still working, -// but all new code should use InternalIpDiffSuppress in the tpgresource package instead. -// suppress diff when saved is Ipv4 format while new is required a reference -// this happens for an internal ip for Private Services Connect -func InternalIpDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.InternalIpDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility DurationDiffSuppress is still working, -// but all new code should use DurationDiffSuppress in the tpgresource package instead. -// Suppress diffs for duration format. ex "60.0s" and "60s" same -// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration -func DurationDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.DurationDiffSuppress(k, old, new, d) -} - -// Use this method when the field accepts either an IP address or a -// self_link referencing a resource (such as google_compute_route's -// next_hop_ilb) -// -// Deprecated: For backward compatibility CompareIpAddressOrSelfLinkOrResourceName is still working, -// but all new code should use CompareIpAddressOrSelfLinkOrResourceName in the tpgresource package instead. -func CompareIpAddressOrSelfLinkOrResourceName(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareIpAddressOrSelfLinkOrResourceName("", old, new, nil) -} - -// Use this method when subnet is optioanl and auto_create_subnetworks = true -// API sometimes choose a subnet so the diff needs to be ignored -// -// Deprecated: For backward compatibility CompareOptionalSubnet is still working, -// but all new code should use CompareOptionalSubnet in the tpgresource package instead. -func CompareOptionalSubnet(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareOptionalSubnet("", old, new, nil) -} - -// Deprecated: For backward compatibility LastSlashDiffSuppress is still working, -// but all new code should use LastSlashDiffSuppress in the tpgresource package instead. -// Suppress diffs in below cases -// "https://hello-rehvs75zla-uc.a.run.app/" -> "https://hello-rehvs75zla-uc.a.run.app" -// "https://hello-rehvs75zla-uc.a.run.app" -> "https://hello-rehvs75zla-uc.a.run.app/" -func LastSlashDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.LastSlashDiffSuppress(k, old, new, d) -} - -// Deprecated: For backward compatibility ProjectNumberDiffSuppress is still working, -// but all new code should use ProjectNumberDiffSuppress in the tpgresource package instead. -// Suppress diffs when the value read from api -// has the project number instead of the project name -func ProjectNumberDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.ProjectNumberDiffSuppress(k, old, new, d) -} - -func compareCryptoKeyVersions(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareCryptoKeyVersions("", old, new, nil) -} - -func cidrOrSizeDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - return tpgresource.CidrOrSizeDiffSuppress(k, old, new, d) -} diff --git a/google/common_operation.go b/google/common_operation.go deleted file mode 100644 index 4b67c0df1cf..00000000000 --- a/google/common_operation.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -// Deprecated: For backward compatibility CommonRefreshFunc is still working, -// but all new code should use CommonRefreshFunc in the tpgresource package instead. -func CommonRefreshFunc(w tpgresource.Waiter) resource.StateRefreshFunc { - return tpgresource.CommonRefreshFunc(w) -} - -// Deprecated: For backward compatibility OperationWait is still working, -// but all new code should use OperationWait in the tpgresource package instead. -func OperationWait(w tpgresource.Waiter, activity string, timeout time.Duration, pollInterval time.Duration) error { - return tpgresource.OperationWait(w, activity, timeout, pollInterval) -} diff --git a/google/common_polling.go b/google/common_polling.go deleted file mode 100644 index 06bfe5ee96d..00000000000 --- a/google/common_polling.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Helper functions to construct result of single pollRead as return result for a PollCheckResponseFunc -// -// Deprecated: For backward compatibility ErrorPollResult is still working, -// but all new code should use ErrorPollResult in the transport_tpg package instead. -func ErrorPollResult(err error) transport_tpg.PollResult { - return transport_tpg.ErrorPollResult(err) -} - -// Deprecated: For backward compatibility PendingStatusPollResult is still working, -// but all new code should use PendingStatusPollResult in the transport_tpg package instead. -func PendingStatusPollResult(status string) transport_tpg.PollResult { - return transport_tpg.PendingStatusPollResult(status) -} - -// Deprecated: For backward compatibility SuccessPollResult is still working, -// but all new code should use SuccessPollResult in the transport_tpg package instead. -func SuccessPollResult() transport_tpg.PollResult { - return transport_tpg.SuccessPollResult() -} - -// Deprecated: For backward compatibility PollingWaitTime is still working, -// but all new code should use PollingWaitTime in the transport_tpg package instead. -func PollingWaitTime(pollF transport_tpg.PollReadFunc, checkResponse transport_tpg.PollCheckResponseFunc, activity string, - timeout time.Duration, targetOccurrences int) error { - return transport_tpg.PollingWaitTime(pollF, checkResponse, activity, timeout, targetOccurrences) -} - -// 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. -// -// Deprecated: For backward compatibility RetryWithTargetOccurrences is still working, -// but all new code should use RetryWithTargetOccurrences in the transport_tpg package instead. -func RetryWithTargetOccurrences(timeout time.Duration, targetOccurrences int, - f resource.RetryFunc) error { - return transport_tpg.RetryWithTargetOccurrences(timeout, targetOccurrences, f) -} - -/** - * Common PollCheckResponseFunc implementations - */ - -// PollCheckForExistence waits for a successful response, continues polling on 404, -// and returns any other error. -// -// Deprecated: For backward compatibility PollCheckForExistence is still working, -// but all new code should use PollCheckForExistence in the transport_tpg package instead. -func PollCheckForExistence(_ map[string]interface{}, respErr error) transport_tpg.PollResult { - return transport_tpg.PollCheckForExistence(nil, respErr) -} - -// PollCheckForExistenceWith403 waits for a successful response, continues polling on 404 or 403, -// and returns any other error. -// -// Deprecated: For backward compatibility PollCheckForExistenceWith403 is still working, -// but all new code should use PollCheckForExistenceWith403 in the transport_tpg package instead. -func PollCheckForExistenceWith403(_ map[string]interface{}, respErr error) transport_tpg.PollResult { - return transport_tpg.PollCheckForExistenceWith403(nil, respErr) -} - -// PollCheckForAbsence waits for a 404/403 response, continues polling on a successful -// response, and returns any other error. -// -// Deprecated: For backward compatibility PollCheckForAbsenceWith403 is still working, -// but all new code should use PollCheckForAbsenceWith403 in the transport_tpg package instead. -func PollCheckForAbsenceWith403(_ map[string]interface{}, respErr error) transport_tpg.PollResult { - return transport_tpg.PollCheckForAbsenceWith403(nil, respErr) -} - -// PollCheckForAbsence waits for a 404 response, continues polling on a successful -// response, and returns any other error. -// -// Deprecated: For backward compatibility PollCheckForAbsence is still working, -// but all new code should use PollCheckForAbsence in the transport_tpg package instead. -func PollCheckForAbsence(_ map[string]interface{}, respErr error) transport_tpg.PollResult { - return transport_tpg.PollCheckForAbsence(nil, respErr) -} diff --git a/google/composer_operation.go b/google/composer_operation.go deleted file mode 100644 index 7f403a0394a..00000000000 --- a/google/composer_operation.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - tpgcomposer "github.com/hashicorp/terraform-provider-google/google/services/composer" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "google.golang.org/api/composer/v1" -) - -// Deprecated: For backward compatibility ComposerOperationWaitTime is still working, -// but all new code should use ComposerOperationWaitTime in the tpgcomposer package instead. -func ComposerOperationWaitTime(config *transport_tpg.Config, op *composer.Operation, project, activity, userAgent string, timeout time.Duration) error { - return tpgcomposer.ComposerOperationWaitTime(config, op, project, activity, userAgent, timeout) -} diff --git a/google/compute_operation.go b/google/compute_operation.go deleted file mode 100644 index d943e672292..00000000000 --- a/google/compute_operation.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/compute" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility ComputeOperationWaitTime is still working, -// but all new code should use ComputeOperationWaitTime in the compute package instead. -func ComputeOperationWaitTime(config *transport_tpg.Config, res interface{}, project, activity, userAgent string, timeout time.Duration) error { - return compute.ComputeOperationWaitTime(config, res, project, activity, userAgent, timeout) -} diff --git a/google/config.go b/google/config.go deleted file mode 100644 index 6924fc418a5..00000000000 --- a/google/config.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility MultiEnvSearch is still working, -// but all new code should use MultiEnvSearch in the transport_tpg package instead. -func MultiEnvSearch(ks []string) string { - return transport_tpg.MultiEnvSearch(ks) -} diff --git a/google/config_test_utils.go b/google/config_test_utils.go deleted file mode 100644 index 5a77affffed..00000000000 --- a/google/config_test_utils.go +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "net/http/httptest" - "strings" -) - -const testFakeCredentialsPath = "./test-fixtures/fake_account.json" - -// NewTestConfig create a config using the http test server. -func NewTestConfig(server *httptest.Server) *transport_tpg.Config { - cfg := &transport_tpg.Config{} - cfg.Client = server.Client() - configureTestBasePaths(cfg, server.URL) - return cfg -} - -func configureTestBasePaths(c *transport_tpg.Config, url string) { - if !strings.HasSuffix(url, "/") { - url = url + "/" - } - // Generated Products - c.AccessApprovalBasePath = url - c.AccessContextManagerBasePath = url - c.ActiveDirectoryBasePath = url - c.AlloydbBasePath = url - c.ApigeeBasePath = url - c.AppEngineBasePath = url - c.ArtifactRegistryBasePath = url - c.BeyondcorpBasePath = url - c.BigQueryBasePath = url - c.BigqueryAnalyticsHubBasePath = url - c.BigqueryConnectionBasePath = url - c.BigqueryDatapolicyBasePath = url - c.BigqueryDataTransferBasePath = url - c.BigqueryReservationBasePath = url - c.BigtableBasePath = url - c.BillingBasePath = url - c.BinaryAuthorizationBasePath = url - c.CertificateManagerBasePath = url - c.CloudAssetBasePath = url - c.CloudBuildBasePath = url - c.Cloudbuildv2BasePath = url - c.CloudFunctionsBasePath = url - c.Cloudfunctions2BasePath = url - c.CloudIdentityBasePath = url - c.CloudIdsBasePath = url - c.CloudIotBasePath = url - c.CloudRunBasePath = url - c.CloudRunV2BasePath = url - c.CloudSchedulerBasePath = url - c.CloudTasksBasePath = url - c.ComputeBasePath = url - c.ContainerAnalysisBasePath = url - c.ContainerAttachedBasePath = url - c.CoreBillingBasePath = url - c.DatabaseMigrationServiceBasePath = url - c.DataCatalogBasePath = url - c.DataFusionBasePath = url - c.DataLossPreventionBasePath = url - c.DataplexBasePath = url - c.DataprocBasePath = url - c.DataprocMetastoreBasePath = url - c.DatastoreBasePath = url - c.DatastreamBasePath = url - c.DeploymentManagerBasePath = url - c.DialogflowBasePath = url - c.DialogflowCXBasePath = url - c.DNSBasePath = url - c.DocumentAIBasePath = url - c.DocumentAIWarehouseBasePath = url - c.EssentialContactsBasePath = url - c.FilestoreBasePath = url - c.FirestoreBasePath = url - c.GameServicesBasePath = url - c.GKEBackupBasePath = url - c.GKEHubBasePath = url - c.GKEHub2BasePath = url - c.HealthcareBasePath = url - c.IAM2BasePath = url - c.IAMBetaBasePath = url - c.IAMWorkforcePoolBasePath = url - c.IapBasePath = url - c.IdentityPlatformBasePath = url - c.KMSBasePath = url - c.LoggingBasePath = url - c.LookerBasePath = url - c.MemcacheBasePath = url - c.MLEngineBasePath = url - c.MonitoringBasePath = url - c.NetworkConnectivityBasePath = url - c.NetworkManagementBasePath = url - c.NetworkSecurityBasePath = url - c.NetworkServicesBasePath = url - c.NotebooksBasePath = url - c.OSConfigBasePath = url - c.OSLoginBasePath = url - c.PrivatecaBasePath = url - c.PublicCABasePath = url - c.PubsubBasePath = url - c.PubsubLiteBasePath = url - c.RedisBasePath = url - c.ResourceManagerBasePath = url - c.SecretManagerBasePath = url - c.SecurityCenterBasePath = url - c.ServiceManagementBasePath = url - c.ServiceUsageBasePath = url - c.SourceRepoBasePath = url - c.SpannerBasePath = url - c.SQLBasePath = url - c.StorageBasePath = url - c.StorageTransferBasePath = url - c.TagsBasePath = url - c.TPUBasePath = url - c.VertexAIBasePath = url - c.VPCAccessBasePath = url - c.WorkflowsBasePath = url - - // Handwritten Products / Versioned / Atypical Entries - c.CloudBillingBasePath = url - c.ComposerBasePath = url - c.ContainerBasePath = url - c.DataprocBasePath = url - c.DataflowBasePath = url - c.IamCredentialsBasePath = url - c.ResourceManagerV3BasePath = url - c.IAMBasePath = url - c.ServiceNetworkingBasePath = url - c.BigQueryBasePath = url - c.StorageTransferBasePath = url - c.BigtableAdminBasePath = url -} diff --git a/google/container_attached_operation.go b/google/container_attached_operation.go deleted file mode 100644 index c51513434a6..00000000000 --- a/google/container_attached_operation.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/containerattached" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// nolint: deadcode,unused -// -// Deprecated: For backward compatibility ContainerAttachedOperationWaitTimeWithResponse is still working, -// but all new code should use ContainerAttachedOperationWaitTimeWithResponse in the containerattached package instead. -func ContainerAttachedOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return containerattached.ContainerAttachedOperationWaitTimeWithResponse(config, op, response, project, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility ContainerAttachedOperationWaitTime is still working, -// but all new code should use ContainerAttachedOperationWaitTime in the containerattached package instead. -func ContainerAttachedOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return containerattached.ContainerAttachedOperationWaitTime(config, op, project, activity, userAgent, timeout) -} diff --git a/google/container_operation.go b/google/container_operation.go deleted file mode 100644 index 38c706ba1ab..00000000000 --- a/google/container_operation.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - tpgcontainer "github.com/hashicorp/terraform-provider-google/google/services/container" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "google.golang.org/api/container/v1" -) - -// Deprecated: For backward compatibility ContainerOperationWait is still working, -// but all new code should use ContainerOperationWait in the tpgcontainer package instead. -func ContainerOperationWait(config *transport_tpg.Config, op *container.Operation, project, location, activity, userAgent string, timeout time.Duration) error { - return tpgcontainer.ContainerOperationWait(config, op, project, location, activity, userAgent, timeout) -} diff --git a/google/convert.go b/google/convert.go deleted file mode 100644 index 362c2408ad4..00000000000 --- a/google/convert.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -// Convert between two types by converting to/from JSON. Intended to switch -// between multiple API versions, as they are strict supersets of one another. -// item and out are pointers to structs -// -// Deprecated: For backward compatibility Convert is still working, -// but all new code should use Convert in the tpgresource package instead. -func Convert(item, out interface{}) error { - return tpgresource.Convert(item, out) -} - -// When converting to a map, we can't use setOmittedFields because FieldByName -// fails. Luckily, we don't use the omitted fields anymore with generated -// resources, and this function is used to bridge from handwritten -> generated. -// Since this is a known type, we can create it inline instead of needing to -// pass an object in. -// -// Deprecated: For backward compatibility ConvertToMap is still working, -// but all new code should use ConvertToMap in the tpgresource package instead. -func ConvertToMap(item interface{}) (map[string]interface{}, error) { - return tpgresource.ConvertToMap(item) -} diff --git a/google/data_source_google_billing_account.go b/google/data_source_google_billing_account.go deleted file mode 100644 index 41322e04980..00000000000 --- a/google/data_source_google_billing_account.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/billing" -) - -func canonicalBillingAccountName(ba string) string { - return billing.CanonicalBillingAccountName(ba) -} diff --git a/google/data_source_google_compute_address.go b/google/data_source_google_compute_address.go deleted file mode 100644 index f3b21f366d7..00000000000 --- a/google/data_source_google_compute_address.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/compute" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func parseComputeAddressId(id string, config *transport_tpg.Config) (*compute.ComputeAddressId, error) { - return compute.ParseComputeAddressId(id, config) -} diff --git a/google/data_source_google_service_account_jwt.go b/google/data_source_google_service_account_jwt.go deleted file mode 100644 index d898f0aaca0..00000000000 --- a/google/data_source_google_service_account_jwt.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - -var ( - dataSourceGoogleServiceAccountJwtNow = resourcemanager.DataSourceGoogleServiceAccountJwtNow -) diff --git a/google/dataproc_cluster_operation.go b/google/dataproc_cluster_operation.go deleted file mode 100644 index e0a0e2dc06f..00000000000 --- a/google/dataproc_cluster_operation.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - tpgdataproc "github.com/hashicorp/terraform-provider-google/google/services/dataproc" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "google.golang.org/api/dataproc/v1" -) - -// Deprecated: For backward compatibility dataprocClusterOperationWait is still working, -// but all new code should use DataprocClusterOperationWait in the tpgdataproc package instead. -func dataprocClusterOperationWait(config *transport_tpg.Config, op *dataproc.Operation, activity, userAgent string, timeout time.Duration) error { - return tpgdataproc.DataprocClusterOperationWait(config, op, activity, userAgent, timeout) -} diff --git a/google/dataproc_job_operation.go b/google/dataproc_job_operation.go deleted file mode 100644 index 6f2ad784b25..00000000000 --- a/google/dataproc_job_operation.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/dataproc" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility dataprocJobOperationWait is still working, -// but all new code should use DataprocJobOperationWait in the dataproc package instead. -func dataprocJobOperationWait(config *transport_tpg.Config, region, projectId, jobId, activity, userAgent string, timeout time.Duration) error { - return dataproc.DataprocJobOperationWait(config, region, projectId, jobId, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility dataprocDeleteOperationWait is still working, -// but all new code should use DataprocDeleteOperationWait in the dataproc package instead. -func dataprocDeleteOperationWait(config *transport_tpg.Config, region, projectId, jobId, activity, userAgent string, timeout time.Duration) error { - return dataproc.DataprocDeleteOperationWait(config, region, projectId, jobId, activity, userAgent, timeout) -} diff --git a/google/datasource_helpers.go b/google/datasource_helpers.go deleted file mode 100644 index 80960ebea52..00000000000 --- a/google/datasource_helpers.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -// datasourceSchemaFromResourceSchema is a recursive func that -// converts an existing Resource schema to a Datasource schema. -// All schema elements are copied, but certain attributes are ignored or changed: -// - all attributes have Computed = true -// - all attributes have ForceNew, Required = false -// - Validation funcs and attributes (e.g. MaxItems) are not copied -// -// Deprecated: For backward compatibility datasourceSchemaFromResourceSchema is still working, -// but all new code should use DatasourceSchemaFromResourceSchema in the tpgresource package instead. -func datasourceSchemaFromResourceSchema(rs map[string]*schema.Schema) map[string]*schema.Schema { - return tpgresource.DatasourceSchemaFromResourceSchema(rs) -} - -// fixDatasourceSchemaFlags is a convenience func that toggles the Computed, -// Optional + Required flags on a schema element. This is useful when the schema -// has been generated (using `datasourceSchemaFromResourceSchema` above for -// example) and therefore the attribute flags were not set appropriately when -// first added to the schema definition. Currently only supports top-level -// schema elements. -// -// Deprecated: For backward compatibility fixDatasourceSchemaFlags is still working, -// but all new code should use FixDatasourceSchemaFlags in the tpgresource package instead. -func fixDatasourceSchemaFlags(schema map[string]*schema.Schema, required bool, keys ...string) { - tpgresource.FixDatasourceSchemaFlags(schema, required, keys...) -} - -// Deprecated: For backward compatibility addRequiredFieldsToSchema is still working, -// but all new code should use AddRequiredFieldsToSchema in the tpgresource package instead. -func addRequiredFieldsToSchema(schema map[string]*schema.Schema, keys ...string) { - tpgresource.AddRequiredFieldsToSchema(schema, keys...) -} - -// Deprecated: For backward compatibility addOptionalFieldsToSchema is still working, -// but all new code should use AddOptionalFieldsToSchema in the tpgresource package instead. -func addOptionalFieldsToSchema(schema map[string]*schema.Schema, keys ...string) { - tpgresource.AddOptionalFieldsToSchema(schema, keys...) -} diff --git a/google/datasource_iam_policy.go b/google/datasource_iam_policy.go deleted file mode 100644 index 5f1a6468f71..00000000000 --- a/google/datasource_iam_policy.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" -) - -// Deprecated: For backward compatibility DataSourceIamPolicy is still working, -// but all new code should use DataSourceIamPolicy in the tpgiamresource package instead. -func DataSourceIamPolicy(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc tpgiamresource.NewResourceIamUpdaterFunc, options ...func(*tpgiamresource.IamSettings)) *schema.Resource { - return tpgiamresource.DataSourceIamPolicy(parentSpecificSchema, newUpdaterFunc, options...) -} diff --git a/google/datastream_operation.go b/google/datastream_operation.go deleted file mode 100644 index 3d672d39e69..00000000000 --- a/google/datastream_operation.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/datastream" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// nolint: deadcode,unused -// -// Deprecated: For backward compatibility DatastreamOperationWaitTimeWithResponse is still working, -// but all new code should use DatastreamOperationWaitTimeWithResponse in the datastream package instead. -func DatastreamOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return datastream.DatastreamOperationWaitTimeWithResponse(config, op, response, project, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility DatastreamOperationWaitTime is still working, -// but all new code should use DatastreamOperationWaitTime in the datastream package instead. -func DatastreamOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return datastream.DatastreamOperationWaitTime(config, op, project, activity, userAgent, timeout) -} diff --git a/google/deployment_manager_operation.go b/google/deployment_manager_operation.go deleted file mode 100644 index 9fbe66983ae..00000000000 --- a/google/deployment_manager_operation.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/deploymentmanager" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility DeploymentManagerOperationWaitTime is still working, -// but all new code should use DeploymentManagerOperationWaitTime in the deploymentmanager package instead. -func DeploymentManagerOperationWaitTime(config *transport_tpg.Config, resp interface{}, project, activity, userAgent string, timeout time.Duration) error { - return deploymentmanager.DeploymentManagerOperationWaitTime(config, resp, project, activity, userAgent, timeout) -} diff --git a/google/dialogflow_cx_operation.go b/google/dialogflow_cx_operation.go deleted file mode 100644 index 87ab44b0a1a..00000000000 --- a/google/dialogflow_cx_operation.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/dialogflowcx" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// nolint: deadcode,unused -// -// Deprecated: For backward compatibility DialogflowCXOperationWaitTimeWithResponse is still working, -// but all new code should use DialogflowCXOperationWaitTimeWithResponse in the dialogflowcx package instead. -func DialogflowCXOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent, location string, timeout time.Duration) error { - return dialogflowcx.DialogflowCXOperationWaitTimeWithResponse(config, op, response, activity, userAgent, location, timeout) -} - -// Deprecated: For backward compatibility DialogflowCXOperationWaitTime is still working, -// but all new code should use DialogflowCXOperationWaitTime in the dialogflowcx package instead. -func DialogflowCXOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent, location string, timeout time.Duration) error { - return dialogflowcx.DialogflowCXOperationWaitTime(config, op, activity, userAgent, location, timeout) -} diff --git a/google/error_retry_predicates.go b/google/error_retry_predicates.go deleted file mode 100644 index a335892aefd..00000000000 --- a/google/error_retry_predicates.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// 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. -// -// Deprecated: For backward compatibility FINGERPRINT_FAIL_ERRORS is still working, -// but all new code should use FINGERPRINT_FAIL_ERRORS in the transport_tpg package instead. -var FINGERPRINT_FAIL_ERRORS = transport_tpg.FINGERPRINT_FAIL_ERRORS - -// Retry the operation if it looks like a fingerprint mismatch. -// -// Deprecated: For backward compatibility IsFingerprintError is still working, -// but all new code should use IsFingerprintError in the transport_tpg package instead. -func IsFingerprintError(err error) (bool, string) { - return transport_tpg.IsFingerprintError(err) -} - -// 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 -// -// Deprecated: For backward compatibility IamMemberMissing is still working, -// but all new code should use IamMemberMissing in the transport_tpg package instead. -func IamMemberMissing(err error) (bool, string) { - return transport_tpg.IamMemberMissing(err) -} - -// 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 -// -// Deprecated: For backward compatibility PubsubTopicProjectNotReady is still working, -// but all new code should use PubsubTopicProjectNotReady in the transport_tpg package instead. -func PubsubTopicProjectNotReady(err error) (bool, string) { - return transport_tpg.PubsubTopicProjectNotReady(err) -} - -// Retry if Cloud SQL operation returns a 429 with a specific message for -// concurrent operations. -// -// Deprecated: For backward compatibility IsSqlOperationInProgressError is still working, -// but all new code should use IsSqlOperationInProgressError in the transport_tpg package instead. -func IsSqlOperationInProgressError(err error) (bool, string) { - return transport_tpg.IsSqlOperationInProgressError(err) -} - -// 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) -// -// Deprecated: For backward compatibility ServiceUsageServiceBeingActivated is still working, -// but all new code should use ServiceUsageServiceBeingActivated in the transport_tpg package instead. -func ServiceUsageServiceBeingActivated(err error) (bool, string) { - return transport_tpg.ServiceUsageServiceBeingActivated(err) -} - -// Retry if Bigquery operation returns a 403 with a specific message for -// concurrent operations (which are implemented in terms of 'edit quota'). -// -// Deprecated: For backward compatibility IsBigqueryIAMQuotaError is still working, -// but all new code should use IsBigqueryIAMQuotaError in the transport_tpg package instead. -func IsBigqueryIAMQuotaError(err error) (bool, string) { - return transport_tpg.IsBigqueryIAMQuotaError(err) -} - -// Retry if Monitoring operation returns a 409 with a specific message for -// concurrent operations. -// -// Deprecated: For backward compatibility IsMonitoringConcurrentEditError is still working, -// but all new code should use IsMonitoringConcurrentEditError in the transport_tpg package instead. -func IsMonitoringConcurrentEditError(err error) (bool, string) { - return transport_tpg.IsMonitoringConcurrentEditError(err) -} - -// Retry if KMS CryptoKeyVersions returns a 400 for PENDING_GENERATION -// -// Deprecated: For backward compatibility IsCryptoKeyVersionsPendingGeneration is still working, -// but all new code should use IsCryptoKeyVersionsPendingGeneration in the transport_tpg package instead. -func IsCryptoKeyVersionsPendingGeneration(err error) (bool, string) { - return transport_tpg.IsCryptoKeyVersionsPendingGeneration(err) -} - -// Retry if getting a resource/operation returns a 404 for specific operations. -// opType should describe the operation for which 404 can be retryable. -// -// Deprecated: For backward compatibility IsNotFoundRetryableError is still working, -// but all new code should use IsNotFoundRetryableError in the transport_tpg package instead. -func IsNotFoundRetryableError(opType string) transport_tpg.RetryErrorPredicateFunc { - return transport_tpg.IsNotFoundRetryableError(opType) -} - -// Deprecated: For backward compatibility IsDataflowJobUpdateRetryableError is still working, -// but all new code should use IsDataflowJobUpdateRetryableError in the transport_tpg package instead. -func IsDataflowJobUpdateRetryableError(err error) (bool, string) { - return transport_tpg.IsDataflowJobUpdateRetryableError(err) -} - -// Deprecated: For backward compatibility IsPeeringOperationInProgress is still working, -// but all new code should use IsPeeringOperationInProgress in the transport_tpg package instead. -func IsPeeringOperationInProgress(err error) (bool, string) { - return transport_tpg.IsPeeringOperationInProgress(err) -} - -// Deprecated: For backward compatibility DatastoreIndex409Contention is still working, -// but all new code should use DatastoreIndex409Contention in the transport_tpg package instead. -func DatastoreIndex409Contention(err error) (bool, string) { - return transport_tpg.DatastoreIndex409Contention(err) -} - -// Deprecated: For backward compatibility IapClient409Operation is still working, -// but all new code should use IapClient409Operation in the transport_tpg package instead. -func IapClient409Operation(err error) (bool, string) { - return transport_tpg.IapClient409Operation(err) -} - -// Deprecated: For backward compatibility HealthcareDatasetNotInitialized is still working, -// but all new code should use HealthcareDatasetNotInitialized in the transport_tpg package instead. -func HealthcareDatasetNotInitialized(err error) (bool, string) { - return transport_tpg.HealthcareDatasetNotInitialized(err) -} - -// 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. -// -// Deprecated: For backward compatibility IsCloudRunCreationConflict is still working, -// but all new code should use IsCloudRunCreationConflict in the transport_tpg package instead. -func IsCloudRunCreationConflict(err error) (bool, string) { - return transport_tpg.IsCloudRunCreationConflict(err) -} - -// 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. -// -// Deprecated: For backward compatibility IamServiceAccountNotFound is still working, -// but all new code should use IamServiceAccountNotFound in the transport_tpg package instead. -func IamServiceAccountNotFound(err error) (bool, string) { - return transport_tpg.IamServiceAccountNotFound(err) -} - -// Concurrent Apigee operations can fail with a 400 error -// -// Deprecated: For backward compatibility IsApigeeRetryableError is still working, -// but all new code should use IsApigeeRetryableError in the transport_tpg package instead. -func IsApigeeRetryableError(err error) (bool, string) { - return transport_tpg.IsApigeeRetryableError(err) -} - -func IsSwgAutogenRouterRetryable(err error) (bool, string) { - return transport_tpg.IsSwgAutogenRouterRetryable(err) -} diff --git a/google/extract.go b/google/extract.go deleted file mode 100644 index b1ce7cf6994..00000000000 --- a/google/extract.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/logging" -) - -// ExtractFieldByPattern returns the value of a field extracted from a parent field according to the given regular expression pattern. -// An error is returned if the field already has a value different than the value extracted. -func ExtractFieldByPattern(fieldName, fieldValue, parentFieldValue, pattern string) (string, error) { - return logging.ExtractFieldByPattern(fieldName, fieldValue, parentFieldValue, pattern) -} diff --git a/google/field_helpers.go b/google/field_helpers.go deleted file mode 100644 index c4a179b3ca8..00000000000 --- a/google/field_helpers.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -const ( - // Deprecated: For backward compatibility globalLinkTemplate is still working, - // but all new code should use GlobalLinkTemplate in the tpgresource package instead. - globalLinkTemplate = tpgresource.GlobalLinkTemplate - // Deprecated: For backward compatibility globalLinkBasePattern is still working, - // but all new code should use GlobalLinkBasePattern in the tpgresource package instead. - globalLinkBasePattern = tpgresource.GlobalLinkBasePattern - // Deprecated: For backward compatibility zonalLinkTemplate is still working, - // but all new code should use ZonalLinkTemplate in the tpgresource package instead. - zonalLinkTemplate = tpgresource.ZonalLinkTemplate - // Deprecated: For backward compatibility zonalLinkBasePattern is still working, - // but all new code should use ZonalLinkBasePattern in the tpgresource package instead. - zonalLinkBasePattern = tpgresource.ZonalLinkBasePattern - // Deprecated: For backward compatibility zonalPartialLinkBasePattern is still working, - // but all new code should use ZonalPartialLinkBasePattern in the tpgresource package instead. - zonalPartialLinkBasePattern = tpgresource.ZonalPartialLinkBasePattern - // Deprecated: For backward compatibility regionalLinkTemplate is still working, - // but all new code should use RegionalLinkTemplate in the tpgresource package instead. - regionalLinkTemplate = tpgresource.RegionalLinkTemplate - // Deprecated: For backward compatibility regionalLinkBasePattern is still working, - // but all new code should use RegionalLinkBasePattern in the tpgresource package instead. - regionalLinkBasePattern = tpgresource.RegionalLinkBasePattern - // Deprecated: For backward compatibility regionalPartialLinkBasePattern is still working, - // but all new code should use RegionalPartialLinkBasePattern in the tpgresource package instead. - regionalPartialLinkBasePattern = tpgresource.RegionalPartialLinkBasePattern - // Deprecated: For backward compatibility projectLinkTemplate is still working, - // but all new code should use ProjectLinkTemplate in the tpgresource package instead. - projectLinkTemplate = tpgresource.ProjectLinkTemplate - // Deprecated: For backward compatibility projectBasePattern is still working, - // but all new code should use ProjectBasePattern in the tpgresource package instead. - projectBasePattern = tpgresource.ProjectBasePattern - // Deprecated: For backward compatibility organizationLinkTemplate is still working, - // but all new code should use OrganizationLinkTemplate in the tpgresource package instead. - organizationLinkTemplate = tpgresource.OrganizationLinkTemplate - // Deprecated: For backward compatibility organizationBasePattern is still working, - // but all new code should use OrganizationBasePattern in the tpgresource package instead. - organizationBasePattern = tpgresource.OrganizationBasePattern -) - -// ------------------------------------------------------------ -// Field helpers -// ------------------------------------------------------------ - -// Deprecated: For backward compatibility ParseNetworkFieldValue is still working, -// but all new code should use ParseNetworkFieldValue in the tpgresource package instead. -func ParseNetworkFieldValue(network string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseNetworkFieldValue(network, d, config) -} - -// Deprecated: For backward compatibility ParseSubnetworkFieldValue is still working, -// but all new code should use ParseSubnetworkFieldValue in the tpgresource package instead. -func ParseSubnetworkFieldValue(subnetwork string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.RegionalFieldValue, error) { - return tpgresource.ParseSubnetworkFieldValue(subnetwork, d, config) -} - -// Deprecated: For backward compatibility ParseSubnetworkFieldValueWithProjectField is still working, -// but all new code should use ParseSubnetworkFieldValueWithProjectField in the tpgresource package instead. -func ParseSubnetworkFieldValueWithProjectField(subnetwork, projectField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.RegionalFieldValue, error) { - return tpgresource.ParseSubnetworkFieldValueWithProjectField(subnetwork, projectField, d, config) -} - -// Deprecated: For backward compatibility ParseSslCertificateFieldValue is still working, -// but all new code should use ParseSslCertificateFieldValue in the tpgresource package instead. -func ParseSslCertificateFieldValue(sslCertificate string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseSslCertificateFieldValue(sslCertificate, d, config) -} - -// Deprecated: For backward compatibility ParseHttpHealthCheckFieldValue is still working, -// but all new code should use ParseHttpHealthCheckFieldValue in the tpgresource package instead. -func ParseHttpHealthCheckFieldValue(healthCheck string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseHttpHealthCheckFieldValue(healthCheck, d, config) -} - -// Deprecated: For backward compatibility ParseDiskFieldValue is still working, -// but all new code should use ParseDiskFieldValue in the tpgresource package instead. -func ParseDiskFieldValue(disk string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseDiskFieldValue(disk, d, config) -} - -// Deprecated: For backward compatibility ParseRegionDiskFieldValue is still working, -// but all new code should use ParseRegionDiskFieldValue in the tpgresource package instead. -func ParseRegionDiskFieldValue(disk string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.RegionalFieldValue, error) { - return tpgresource.ParseRegionDiskFieldValue(disk, d, config) -} - -// Deprecated: For backward compatibility ParseOrganizationCustomRoleName is still working, -// but all new code should use ParseOrganizationCustomRoleName in the tpgresource package instead. -func ParseOrganizationCustomRoleName(role string) (*tpgresource.OrganizationFieldValue, error) { - return tpgresource.ParseOrganizationCustomRoleName(role) -} - -// Deprecated: For backward compatibility ParseAcceleratorFieldValue is still working, -// but all new code should use ParseAcceleratorFieldValue in the tpgresource package instead. -func ParseAcceleratorFieldValue(accelerator string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseAcceleratorFieldValue(accelerator, d, config) -} - -// Deprecated: For backward compatibility ParseMachineTypesFieldValue is still working, -// but all new code should use ParseMachineTypesFieldValue in the tpgresource package instead. -func ParseMachineTypesFieldValue(machineType string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseMachineTypesFieldValue(machineType, d, config) -} - -// Deprecated: For backward compatibility ParseInstanceFieldValue is still working, -// but all new code should use ParseInstanceFieldValue in the tpgresource package instead. -func ParseInstanceFieldValue(instance string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseInstanceFieldValue(instance, d, config) -} - -// Deprecated: For backward compatibility ParseInstanceGroupFieldValue is still working, -// but all new code should use ParseInstanceGroupFieldValue in the tpgresource package instead. -func ParseInstanceGroupFieldValue(instanceGroup string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseInstanceGroupFieldValue(instanceGroup, d, config) -} - -// Deprecated: For backward compatibility ParseInstanceTemplateFieldValue is still working, -// but all new code should use ParseInstanceTemplateFieldValue in the tpgresource package instead. -func ParseInstanceTemplateFieldValue(instanceTemplate string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseInstanceTemplateFieldValue(instanceTemplate, d, config) -} - -// Deprecated: For backward compatibility ParseMachineImageFieldValue is still working, -// but all new code should use ParseMachineImageFieldValue in the tpgresource package instead. -func ParseMachineImageFieldValue(machineImage string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseMachineImageFieldValue(machineImage, d, config) -} - -// Deprecated: For backward compatibility ParseSecurityPolicyFieldValue is still working, -// but all new code should use ParseSecurityPolicyFieldValue in the tpgresource package instead. -func ParseSecurityPolicyFieldValue(securityPolicy string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseSecurityPolicyFieldValue(securityPolicy, d, config) -} - -// Deprecated: For backward compatibility ParseNetworkEndpointGroupFieldValue is still working, -// but all new code should use ParseNetworkEndpointGroupFieldValue in the tpgresource package instead. -func ParseNetworkEndpointGroupFieldValue(networkEndpointGroup string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseNetworkEndpointGroupFieldValue(networkEndpointGroup, d, config) -} - -// Deprecated: For backward compatibility ParseNetworkEndpointGroupRegionalFieldValue is still working, -// but all new code should use ParseNetworkEndpointGroupRegionalFieldValue in the tpgresource package instead. -func ParseNetworkEndpointGroupRegionalFieldValue(networkEndpointGroup string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (*tpgresource.RegionalFieldValue, error) { - return tpgresource.ParseNetworkEndpointGroupRegionalFieldValue(networkEndpointGroup, d, config) -} - -// ------------------------------------------------------------ -// Base helpers used to create helpers for specific fields. -// ------------------------------------------------------------ - -// Parses a global field supporting 5 different formats: -// - https://www.googleapis.com/compute/ANY_VERSION/projects/{my_project}/global/{resource_type}/{resource_name} -// - projects/{my_project}/global/{resource_type}/{resource_name} -// - global/{resource_type}/{resource_name} -// - resource_name -// - "" (empty string). RelativeLink() returns empty if isEmptyValid is true. -// -// If the project is not specified, it first tries to get the project from the `projectSchemaField` and then fallback on the default project. -// -// Deprecated: For backward compatibility parseGlobalFieldValue is still working, -// but all new code should use ParseGlobalFieldValue in the tpgresource package instead. -func parseGlobalFieldValue(resourceType, fieldValue, projectSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config, isEmptyValid bool) (*tpgresource.GlobalFieldValue, error) { - return tpgresource.ParseGlobalFieldValue(resourceType, fieldValue, projectSchemaField, d, config, isEmptyValid) -} - -// Parses a zonal field supporting 5 different formats: -// - https://www.googleapis.com/compute/ANY_VERSION/projects/{my_project}/zones/{zone}/{resource_type}/{resource_name} -// - projects/{my_project}/zones/{zone}/{resource_type}/{resource_name} -// - zones/{zone}/{resource_type}/{resource_name} -// - resource_name -// - "" (empty string). RelativeLink() returns empty if isEmptyValid is true. -// -// If the project is not specified, it first tries to get the project from the `projectSchemaField` and then fallback on the default project. -// If the zone is not specified, it takes the value of `zoneSchemaField`. -// -// Deprecated: For backward compatibility parseZonalFieldValue is still working, -// but all new code should use ParseZonalFieldValue in the tpgresource package instead. -func parseZonalFieldValue(resourceType, fieldValue, projectSchemaField, zoneSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config, isEmptyValid bool) (*tpgresource.ZonalFieldValue, error) { - return tpgresource.ParseZonalFieldValue(resourceType, fieldValue, projectSchemaField, zoneSchemaField, d, config, isEmptyValid) -} - -// Deprecated: For backward compatibility getProjectFromSchema is still working, -// but all new code should use GetProjectFromSchema in the tpgresource package instead. -func getProjectFromSchema(projectSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetProjectFromSchema(projectSchemaField, d, config) -} - -// Deprecated: For backward compatibility getBillingProjectFromSchema is still working, -// but all new code should use GetBillingProjectFromSchema in the tpgresource package instead. -func getBillingProjectFromSchema(billingProjectSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetBillingProjectFromSchema(billingProjectSchemaField, d, config) -} - -// Parses an organization field with the following formats: -// - organizations/{my_organizations}/{resource_type}/{resource_name} -// -// Deprecated: For backward compatibility parseOrganizationFieldValue is still working, -// but all new code should use ParseOrganizationFieldValue in the tpgresource package instead. -func parseOrganizationFieldValue(resourceType, fieldValue string, isEmptyValid bool) (*tpgresource.OrganizationFieldValue, error) { - return tpgresource.ParseOrganizationFieldValue(resourceType, fieldValue, isEmptyValid) -} - -// Parses a regional field supporting 5 different formats: -// - https://www.googleapis.com/compute/ANY_VERSION/projects/{my_project}/regions/{region}/{resource_type}/{resource_name} -// - projects/{my_project}/regions/{region}/{resource_type}/{resource_name} -// - regions/{region}/{resource_type}/{resource_name} -// - resource_name -// - "" (empty string). RelativeLink() returns empty if isEmptyValid is true. -// -// If the project is not specified, it first tries to get the project from the `projectSchemaField` and then fallback on the default project. -// If the region is not specified, see function documentation for `getRegionFromSchema`. -// -// Deprecated: For backward compatibility parseRegionalFieldValue is still working, -// but all new code should use ParseRegionalFieldValue in the tpgresource package instead. -func parseRegionalFieldValue(resourceType, fieldValue, projectSchemaField, regionSchemaField, zoneSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config, isEmptyValid bool) (*tpgresource.RegionalFieldValue, error) { - return tpgresource.ParseRegionalFieldValue(resourceType, fieldValue, projectSchemaField, regionSchemaField, zoneSchemaField, d, config, isEmptyValid) -} - -// Infers the region based on the following (in order of priority): -// - `regionSchemaField` in resource schema -// - region extracted from the `zoneSchemaField` in resource schema -// - provider-level region -// - region extracted from the provider-level zone -// -// Deprecated: For backward compatibility getRegionFromSchema is still working, -// but all new code should use GetRegionFromSchema in the tpgresource package instead. -func getRegionFromSchema(regionSchemaField, zoneSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetRegionFromSchema(regionSchemaField, zoneSchemaField, d, config) -} - -// Parses a project field with the following formats: -// - projects/{my_projects}/{resource_type}/{resource_name} -// -// Deprecated: For backward compatibility parseProjectFieldValue is still working, -// but all new code should use ParseProjectFieldValue in the tpgresource package instead. -func parseProjectFieldValue(resourceType, fieldValue, projectSchemaField string, d tpgresource.TerraformResourceData, config *transport_tpg.Config, isEmptyValid bool) (*tpgresource.ProjectFieldValue, error) { - return tpgresource.ParseProjectFieldValue(resourceType, fieldValue, projectSchemaField, d, config, isEmptyValid) -} diff --git a/google/framework_test_utils.go b/google/framework_test_utils.go deleted file mode 100644 index 3bc32f64eda..00000000000 --- a/google/framework_test_utils.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/fwtransport" -) - -// General test utils - -// testExtractResourceAttr navigates a test's state to find the specified resource (or data source) attribute and makes the value -// accessible via the attributeValue string pointer. -func testExtractResourceAttr(resourceName string, attributeName string, attributeValue *string) resource.TestCheckFunc { - return acctest.TestExtractResourceAttr(resourceName, attributeName, attributeValue) -} - -// testCheckAttributeValuesEqual compares two string pointers, which have been used to retrieve attribute values from the test's state. -func testCheckAttributeValuesEqual(i *string, j *string) resource.TestCheckFunc { - return acctest.TestCheckAttributeValuesEqual(i, j) -} - -// This function isn't a test of transport.go; instead, it is used as an alternative -// to ReplaceVars inside tests. -func replaceVarsForFrameworkTest(prov *fwtransport.FrameworkProviderConfig, rs *terraform.ResourceState, linkTmpl string) (string, error) { - return acctest.ReplaceVarsForFrameworkTest(prov, rs, linkTmpl) -} diff --git a/google/framework_transport.go b/google/framework_transport.go deleted file mode 100644 index feeda6e2821..00000000000 --- a/google/framework_transport.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-provider-google/google/fwtransport" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -func sendFrameworkRequest(p *fwtransport.FrameworkProviderConfig, method, project, rawurl, userAgent string, body map[string]interface{}, errorRetryPredicates ...transport_tpg.RetryErrorPredicateFunc) (map[string]interface{}, diag.Diagnostics) { - return fwtransport.SendFrameworkRequest(p, method, project, rawurl, userAgent, body, errorRetryPredicates...) -} - -func sendFrameworkRequestWithTimeout(p *fwtransport.FrameworkProviderConfig, method, project, rawurl, userAgent string, body map[string]interface{}, timeout time.Duration, errorRetryPredicates ...transport_tpg.RetryErrorPredicateFunc) (map[string]interface{}, diag.Diagnostics) { - return fwtransport.SendFrameworkRequestWithTimeout(p, method, project, rawurl, userAgent, body, timeout, errorRetryPredicates...) -} diff --git a/google/framework_utils.go b/google/framework_utils.go deleted file mode 100644 index c8e0f96492b..00000000000 --- a/google/framework_utils.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "context" - - "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-framework/tfsdk" - "github.com/hashicorp/terraform-plugin-framework/types" - - "github.com/hashicorp/terraform-provider-google/google/fwmodels" - "github.com/hashicorp/terraform-provider-google/google/fwresource" - "github.com/hashicorp/terraform-provider-google/google/fwtransport" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -func CompileUserAgentString(ctx context.Context, name, tfVersion, provVersion string) string { - return fwtransport.CompileUserAgentString(ctx, name, tfVersion, provVersion) -} - -func GetCurrentUserEmailFramework(p *fwtransport.FrameworkProviderConfig, userAgent string, diags *diag.Diagnostics) string { - return fwtransport.GetCurrentUserEmailFramework(p, userAgent, diags) -} - -func generateFrameworkUserAgentString(metaData *fwmodels.ProviderMetaModel, currUserAgent string) string { - return fwtransport.GenerateFrameworkUserAgentString(metaData, currUserAgent) -} - -// GetProject reads the "project" field from the given resource and falls -// back to the provider's value if not given. If the provider's value is not -// given, an error is returned. -func getProjectFramework(rVal, pVal types.String, diags *diag.Diagnostics) types.String { - return fwresource.GetProjectFramework(rVal, pVal, diags) -} - -func handleDatasourceNotFoundError(ctx context.Context, err error, state *tfsdk.State, resource string, diags *diag.Diagnostics) { - fwtransport.HandleDatasourceNotFoundError(ctx, err, state, resource, diags) -} - -// field helpers - -// Parses a project field with the following formats: -// - projects/{my_projects}/{resource_type}/{resource_name} -func parseProjectFieldValueFramework(resourceType, fieldValue, projectSchemaField string, rVal, pVal types.String, isEmptyValid bool, diags *diag.Diagnostics) *tpgresource.ProjectFieldValue { - return fwresource.ParseProjectFieldValueFramework(resourceType, fieldValue, projectSchemaField, rVal, pVal, isEmptyValid, diags) -} diff --git a/google/gcp_sweeper.go b/google/gcp_sweeper.go deleted file mode 100644 index aa79bc3ed58..00000000000 --- a/google/gcp_sweeper.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/acctest" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// SharedConfigForRegion returns a common config setup needed for the sweeper -// functions for a given region -func SharedConfigForRegion(region string) (*transport_tpg.Config, error) { - return acctest.SharedConfigForRegion(region) -} - -func IsSweepableTestResource(resourceName string) bool { - return acctest.IsSweepableTestResource(resourceName) -} diff --git a/google/gkeonprem_operation.go b/google/gkeonprem_operation.go deleted file mode 100644 index 9821d4cf9b2..00000000000 --- a/google/gkeonprem_operation.go +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google diff --git a/google/hashcode.go b/google/hashcode.go deleted file mode 100644 index ee713e4d66a..00000000000 --- a/google/hashcode.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import "github.com/hashicorp/terraform-provider-google/google/tpgresource" - -// hashcode hashes a string to a unique hashcode. -// -// crc32 returns a uint32, but for our use we need -// and non negative integer. Here we cast to an integer -// and invert it if the result is negative. -// -// Deprecated: For backward compatibility hashcode is still working, -// but all new code should use Hashcode in the tpgresource package instead. -func hashcode(s string) int { - return tpgresource.Hashcode(s) -} diff --git a/google/iam.go b/google/iam.go deleted file mode 100644 index 5283c3dbe91..00000000000 --- a/google/iam.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -// Utils for modifying IAM policies for resources across GCP -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "google.golang.org/api/cloudresourcemanager/v1" -) - -// Deprecated: For backward compatibility IamPolicyVersion is still working, -// but all new code should use IamPolicyVersion in the tpgiamresource package instead. -const IamPolicyVersion = tpgiamresource.IamPolicyVersion - -type ( - // The ResourceIamUpdater interface is implemented for each GCP resource supporting IAM policy. - // Implementations should be created per resource and should keep track of the resource identifier. - // - // Deprecated: For backward compatibility ResourceIamUpdater is still working, - // but all new code should use ResourceIamUpdater in the tpgiamresource package instead. - ResourceIamUpdater = tpgiamresource.ResourceIamUpdater - - // Parser for Terraform resource identifier (d.Id) for resource whose IAM policy is being changed - // - // Deprecated: For backward compatibility ResourceIdParserFunc is still working, - // but all new code should use ResourceIdParserFunc in the tpgiamresource package instead. - ResourceIdParserFunc = tpgiamresource.ResourceIdParserFunc -) - -// Flattens a list of Bindings so each role+condition has a single Binding with combined members -// -// Deprecated: For backward compatibility MergeBindings is still working, -// but all new code should use MergeBindings in the tpgiamresource package instead. -func MergeBindings(bindings []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding { - return tpgiamresource.MergeBindings(bindings) -} - -// Deprecated: For backward compatibility compareBindings is still working, -// but all new code should use CompareBindings in the tpgiamresource package instead. -func compareBindings(a, b []*cloudresourcemanager.Binding) bool { - return tpgiamresource.CompareBindings(a, b) -} - -// Deprecated: For backward compatibility compareAuditConfigs is still working, -// but all new code should use CompareAuditConfigs in the tpgiamresource package instead. -func compareAuditConfigs(a, b []*cloudresourcemanager.AuditConfig) bool { - return tpgiamresource.CompareAuditConfigs(a, b) -} - -// Util to deref and print auditConfigs -// -// Deprecated: For backward compatibility debugPrintAuditConfigs is still working, -// but all new code should use DebugPrintAuditConfigs in the tpgiamresource package instead. -func debugPrintAuditConfigs(bs []*cloudresourcemanager.AuditConfig) string { - return tpgiamresource.DebugPrintAuditConfigs(bs) -} - -// Util to deref and print bindings -// -// Deprecated: For backward compatibility debugPrintBindings is still working, -// but all new code should use DebugPrintBindings in the tpgiamresource package instead. -func debugPrintBindings(bs []*cloudresourcemanager.Binding) string { - return tpgiamresource.DebugPrintBindings(bs) -} diff --git a/google/iam_bigquery_dataset.go b/google/iam_bigquery_dataset.go deleted file mode 100644 index ad496245e53..00000000000 --- a/google/iam_bigquery_dataset.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/bigquery" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -var IamBigqueryDatasetSchema = bigquery.IamBigqueryDatasetSchema - -func NewBigqueryDatasetIamUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return bigquery.NewBigqueryDatasetIamUpdater(d, config) -} - -func BigqueryDatasetIdParseFunc(d *schema.ResourceData, config *transport_tpg.Config) error { - return bigquery.BigqueryDatasetIdParseFunc(d, config) -} diff --git a/google/iam_bigtable_instance.go b/google/iam_bigtable_instance.go deleted file mode 100644 index 9edd03ce6b3..00000000000 --- a/google/iam_bigtable_instance.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/bigtable" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -var IamBigtableInstanceSchema = bigtable.IamBigtableInstanceSchema - -func NewBigtableInstanceUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return bigtable.NewBigtableInstanceUpdater(d, config) -} - -func BigtableInstanceIdParseFunc(d *schema.ResourceData, config *transport_tpg.Config) error { - return bigtable.BigtableInstanceIdParseFunc(d, config) -} diff --git a/google/iam_bigtable_table.go b/google/iam_bigtable_table.go deleted file mode 100644 index 51cfd20a562..00000000000 --- a/google/iam_bigtable_table.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/bigtable" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -var IamBigtableTableSchema = bigtable.IamBigtableTableSchema - -func NewBigtableTableUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return bigtable.NewBigtableTableUpdater(d, config) -} - -func BigtableTableIdParseFunc(d *schema.ResourceData, config *transport_tpg.Config) error { - return bigtable.BigtableTableIdParseFunc(d, config) -} diff --git a/google/iam_billing_account.go b/google/iam_billing_account.go deleted file mode 100644 index 0f77456950d..00000000000 --- a/google/iam_billing_account.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/billing" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var IamBillingAccountSchema = billing.IamBillingAccountSchema - -func NewBillingAccountIamUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return billing.NewBillingAccountIamUpdater(d, config) -} - -func BillingAccountIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return billing.BillingAccountIdParseFunc(d, nil) -} diff --git a/google/iam_dataproc_cluster.go b/google/iam_dataproc_cluster.go deleted file mode 100644 index 13397bb8913..00000000000 --- a/google/iam_dataproc_cluster.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/services/dataproc" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var IamDataprocClusterSchema = dataproc.IamDataprocClusterSchema - -func NewDataprocClusterUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return dataproc.NewDataprocClusterUpdater(d, config) -} - -func DataprocClusterIdParseFunc(d *schema.ResourceData, config *transport_tpg.Config) error { - return dataproc.DataprocClusterIdParseFunc(d, config) -} diff --git a/google/iam_dataproc_job.go b/google/iam_dataproc_job.go deleted file mode 100644 index 7b2ab792b8a..00000000000 --- a/google/iam_dataproc_job.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/services/dataproc" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var IamDataprocJobSchema = dataproc.IamDataprocJobSchema - -func NewDataprocJobUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return dataproc.NewDataprocJobUpdater(d, config) -} - -func DataprocJobIdParseFunc(d *schema.ResourceData, config *transport_tpg.Config) error { - return dataproc.DataprocJobIdParseFunc(d, config) -} diff --git a/google/iam_folder.go b/google/iam_folder.go deleted file mode 100644 index 7439db8f429..00000000000 --- a/google/iam_folder.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1" - - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var IamFolderSchema = resourcemanager.IamFolderSchema - -func NewFolderIamUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return resourcemanager.NewFolderIamUpdater(d, config) -} - -func FolderIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return resourcemanager.FolderIdParseFunc(d, nil) -} - -func canonicalFolderId(folder string) string { - return resourcemanager.CanonicalFolderId(folder) -} - -// Retrieve the existing IAM Policy for a folder -func getFolderIamPolicyByFolderName(folderName, userAgent string, config *transport_tpg.Config) (*cloudresourcemanager.Policy, error) { - return resourcemanager.GetFolderIamPolicyByFolderName(folderName, userAgent, config) -} diff --git a/google/iam_organization.go b/google/iam_organization.go deleted file mode 100644 index be73b65fd0c..00000000000 --- a/google/iam_organization.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var IamOrganizationSchema = resourcemanager.IamOrganizationSchema - -func NewOrganizationIamUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return resourcemanager.NewOrganizationIamUpdater(d, config) -} - -func OrgIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return resourcemanager.OrgIdParseFunc(d, nil) -} diff --git a/google/iam_project.go b/google/iam_project.go deleted file mode 100644 index b8a679efb80..00000000000 --- a/google/iam_project.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var IamProjectSchema = resourcemanager.IamProjectSchema - -func NewProjectIamUpdater(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (tpgiamresource.ResourceIamUpdater, error) { - return resourcemanager.NewProjectIamUpdater(d, config) -} - -func ProjectIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return resourcemanager.ProjectIdParseFunc(d, nil) -} - -func compareProjectName(_, old, new string, _ *schema.ResourceData) bool { - // We can either get "projects/project-id" or "project-id", so strip any prefixes - return resourcemanager.CompareProjectName("", old, new, nil) -} diff --git a/google/image.go b/google/image.go deleted file mode 100644 index dbc8f5d4fe6..00000000000 --- a/google/image.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/compute" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// built-in projects to look for images/families containing the string -// on the left in -var imageMap = compute.ImageMap - -// If the given name is a URL, return it. -// If it's in the form projects/{project}/global/images/{image}, return it -// If it's in the form projects/{project}/global/images/family/{family}, return it -// If it's in the form global/images/{image}, return it -// If it's in the form global/images/family/{family}, return it -// If it's in the form family/{family}, check if it's a family in the current project. If it is, return it as global/images/family/{family}. -// -// If not, check if it could be a GCP-provided family, and if it exists. If it does, return it as projects/{project}/global/images/family/{family}. -// -// If it's in the form {project}/{family-or-image}, check if it's an image in the named project. If it is, return it as projects/{project}/global/images/{image}. -// -// If not, check if it's a family in the named project. If it is, return it as projects/{project}/global/images/family/{family}. -// -// If it's in the form {family-or-image}, check if it's an image in the current project. If it is, return it as global/images/{image}. -// -// If not, check if it could be a GCP-provided image, and if it exists. If it does, return it as projects/{project}/global/images/{image}. -// If not, check if it's a family in the current project. If it is, return it as global/images/family/{family}. -// If not, check if it could be a GCP-provided family, and if it exists. If it does, return it as projects/{project}/global/images/family/{family} -// -// Deprecated: For backward compatibility resolveImage is still working, -// but all new code should use ResolveImage in the compute package instead. -func resolveImage(c *transport_tpg.Config, project, name, userAgent string) (string, error) { - return compute.ResolveImage(c, project, name, userAgent) -} diff --git a/google/import.go b/google/import.go deleted file mode 100644 index 1047eaba226..00000000000 --- a/google/import.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Parse an import id extracting field values using the given list of regexes. -// They are applied in order. The first in the list is tried first. -// -// e.g: -// - projects/(?P[^/]+)/regions/(?P[^/]+)/subnetworks/(?P[^/]+) (applied first) -// - (?P[^/]+)/(?P[^/]+)/(?P[^/]+), -// - (?P[^/]+) (applied last) -// -// Deprecated: For backward compatibility ParseImportId is still working, -// but all new code should use ParseImportId in the tpgresource package instead. -func ParseImportId(idRegexes []string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) error { - return tpgresource.ParseImportId(idRegexes, d, config) -} - -// Parse an import id extracting field values using the given list of regexes. -// They are applied in order. The first in the list is tried first. -// This does not mutate any of the parameters, returning a map of matches -// Similar to ParseImportId in import.go, but less import specific -// -// e.g: -// - projects/(?P[^/]+)/regions/(?P[^/]+)/subnetworks/(?P[^/]+) (applied first) -// - (?P[^/]+)/(?P[^/]+)/(?P[^/]+), -// - (?P[^/]+) (applied last) -// -// Deprecated: For backward compatibility getImportIdQualifiers is still working, -// but all new code should use GetImportIdQualifiers in the tpgresource package instead. -func getImportIdQualifiers(idRegexes []string, d tpgresource.TerraformResourceData, config *transport_tpg.Config, id string) (map[string]string, error) { - return tpgresource.GetImportIdQualifiers(idRegexes, d, config, id) -} diff --git a/google/logging_exclusion_billing_account.go b/google/logging_exclusion_billing_account.go deleted file mode 100644 index d222ea8ab77..00000000000 --- a/google/logging_exclusion_billing_account.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/logging" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var BillingAccountLoggingExclusionSchema = logging.BillingAccountLoggingExclusionSchema - -func NewBillingAccountLoggingExclusionUpdater(d *schema.ResourceData, config *transport_tpg.Config) (logging.ResourceLoggingExclusionUpdater, error) { - return logging.NewBillingAccountLoggingExclusionUpdater(d, config) -} - -func BillingAccountLoggingExclusionIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return logging.BillingAccountLoggingExclusionIdParseFunc(d, nil) -} diff --git a/google/logging_exclusion_folder.go b/google/logging_exclusion_folder.go deleted file mode 100644 index a38593a9e10..00000000000 --- a/google/logging_exclusion_folder.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/logging" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var FolderLoggingExclusionSchema = logging.FolderLoggingExclusionSchema - -func NewFolderLoggingExclusionUpdater(d *schema.ResourceData, config *transport_tpg.Config) (logging.ResourceLoggingExclusionUpdater, error) { - return logging.NewFolderLoggingExclusionUpdater(d, config) -} - -func FolderLoggingExclusionIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return logging.FolderLoggingExclusionIdParseFunc(d, nil) -} diff --git a/google/logging_exclusion_organization.go b/google/logging_exclusion_organization.go deleted file mode 100644 index 431725c9c9b..00000000000 --- a/google/logging_exclusion_organization.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/logging" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var OrganizationLoggingExclusionSchema = logging.OrganizationLoggingExclusionSchema - -func NewOrganizationLoggingExclusionUpdater(d *schema.ResourceData, config *transport_tpg.Config) (logging.ResourceLoggingExclusionUpdater, error) { - return logging.NewOrganizationLoggingExclusionUpdater(d, config) -} - -func OrganizationLoggingExclusionIdParseFunc(d *schema.ResourceData, _ *transport_tpg.Config) error { - return logging.OrganizationLoggingExclusionIdParseFunc(d, nil) -} diff --git a/google/logging_exclusion_project.go b/google/logging_exclusion_project.go deleted file mode 100644 index 630628cade0..00000000000 --- a/google/logging_exclusion_project.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/terraform-provider-google/google/services/logging" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -var ProjectLoggingExclusionSchema = logging.ProjectLoggingExclusionSchema - -func NewProjectLoggingExclusionUpdater(d *schema.ResourceData, config *transport_tpg.Config) (logging.ResourceLoggingExclusionUpdater, error) { - return logging.NewProjectLoggingExclusionUpdater(d, config) -} - -func ProjectLoggingExclusionIdParseFunc(d *schema.ResourceData, config *transport_tpg.Config) error { - return logging.ProjectLoggingExclusionIdParseFunc(d, config) -} diff --git a/google/logging_utils.go b/google/logging_utils.go deleted file mode 100644 index 1726b3f2871..00000000000 --- a/google/logging_utils.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/logging" -) - -// loggingSinkResourceTypes contains all the possible Stackdriver Logging resource types. Used to parse ids safely. -var loggingSinkResourceTypes = logging.LoggingSinkResourceTypes - -type LoggingSinkId = logging.LoggingSinkId - -// parseLoggingSinkId parses a canonical id into a LoggingSinkId, or returns an error on failure. -func parseLoggingSinkId(id string) (*LoggingSinkId, error) { - return logging.ParseLoggingSinkId(id) -} diff --git a/google/metadata.go b/google/metadata.go deleted file mode 100644 index 96f27e5385a..00000000000 --- a/google/metadata.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "google.golang.org/api/compute/v1" - - tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// 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 MetadataRetryWrapper(update func() error) error { - return transport_tpg.MetadataRetryWrapper(update) -} - -// Update the metadata (serverMD) according to the provided diff (oldMDMap v -// newMDMap). -// -// Deprecated: For backward compatibility MetadataUpdate is still working, -// but all new code should use PollCheckKnaMetadataUpdatetiveStatusFunc in the tpgcompute package instead. -func MetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]interface{}, serverMD *compute.Metadata) { - tpgcompute.MetadataUpdate(oldMDMap, newMDMap, serverMD) -} - -// Update the beta metadata (serverMD) according to the provided diff (oldMDMap v -// newMDMap). -// -// Deprecated: For backward compatibility BetaMetadataUpdate is still working, -// but all new code should use BetaMetadataUpdate in the tpgcompute package instead. -func BetaMetadataUpdate(oldMDMap map[string]interface{}, newMDMap map[string]interface{}, serverMD *compute.Metadata) { - tpgcompute.BetaMetadataUpdate(oldMDMap, newMDMap, serverMD) -} - -// This function differs from flattenMetadataBeta only in that it takes -// compute.metadata rather than compute.metadata as an argument. It should -// be removed in favour of flattenMetadataBeta if/when all resources using it get -// beta support. -// -// Deprecated: For backward compatibility flattenMetadata is still working, -// but all new code should use FlattenMetadata in the tpgcompute package instead. -func flattenMetadata(metadata *compute.Metadata) map[string]interface{} { - return tpgcompute.FlattenMetadata(metadata) -} diff --git a/google/network_security_address_group_operation.go b/google/network_security_address_group_operation.go deleted file mode 100644 index 376657ca4b9..00000000000 --- a/google/network_security_address_group_operation.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/networksecurity" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// NetworkSecurityAddressGroupOperationWaitTime is specific for address group resource because the only difference is that it does not need project param. -func NetworkSecurityAddressGroupOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - // project is not necessary for this operation. - return networksecurity.NetworkSecurityAddressGroupOperationWaitTime(config, op, activity, userAgent, timeout) -} diff --git a/google/path_or_contents.go b/google/path_or_contents.go deleted file mode 100644 index 023ce0febfe..00000000000 --- a/google/path_or_contents.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/verify" -) - -// If the argument is a path, pathOrContents loads it and returns the contents, -// otherwise the argument is assumed to be the desired contents and is simply -// returned. -// -// The boolean second return value can be called `wasPath` - it indicates if a -// path was detected and a file loaded. -func pathOrContents(poc string) (string, bool, error) { - return verify.PathOrContents(poc) -} diff --git a/google/provider_test_utils.go b/google/provider_test_utils.go deleted file mode 100644 index 50e37510665..00000000000 --- a/google/provider_test_utils.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "testing" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -const TestEnvVar = acctest.TestEnvVar - -var TestAccProviders map[string]*schema.Provider - -var CredsEnvVars = acctest.CredsEnvVars - -var projectNumberEnvVars = acctest.ProjectNumberEnvVars - -var ProjectEnvVars = acctest.ProjectEnvVars - -var firestoreProjectEnvVars = acctest.FirestoreProjectEnvVars - -var regionEnvVars = acctest.RegionEnvVars - -var zoneEnvVars = acctest.ZoneEnvVars - -var orgEnvVars = acctest.OrgEnvVars - -// This value is the Customer ID of the GOOGLE_ORG_DOMAIN workspace. -// See https://admin.google.com/ac/accountsettings when logged into an org admin for the value. -var custIdEnvVars = acctest.CustIdEnvVars - -// This value is the username of an identity account within the GOOGLE_ORG_DOMAIN workspace. -// For example in the org example.com with a user "foo@example.com", this would be set to "foo". -// See https://admin.google.com/ac/users when logged into an org admin for a list. -var identityUserEnvVars = acctest.IdentityUserEnvVars - -var orgEnvDomainVars = acctest.OrgEnvDomainVars - -var serviceAccountEnvVars = acctest.ServiceAccountEnvVars - -var orgTargetEnvVars = acctest.OrgTargetEnvVars - -// This is the billing account that will be charged for the infrastructure used during testing. For -// that reason, it is also the billing account used for creating new projects. -var billingAccountEnvVars = acctest.BillingAccountEnvVars - -// This is the billing account that will be modified to test billing-related functionality. It is -// expected to have more permissions granted to the test user and support subaccounts. -var masterBillingAccountEnvVars = acctest.MasterBillingAccountEnvVars - -// This value is the description used for test PublicAdvertisedPrefix setup to avoid required DNS -// setup. This is only used during integration tests and would be invalid to surface to users -var papDescriptionEnvVars = acctest.PapDescriptionEnvVars - -func init() { - TestAccProviders = acctest.TestAccProviders -} - -func GoogleProviderConfig(t *testing.T) *transport_tpg.Config { - return acctest.GoogleProviderConfig(t) -} - -func AccTestPreCheck(t *testing.T) { - acctest.AccTestPreCheck(t) -} - -// GetTestRegion has the same logic as the provider's GetRegion, to be used in tests. -func GetTestRegion(is *terraform.InstanceState, config *transport_tpg.Config) (string, error) { - return acctest.GetTestRegion(is, config) -} - -// GetTestProject has the same logic as the provider's GetProject, to be used in tests. -func GetTestProject(is *terraform.InstanceState, config *transport_tpg.Config) (string, error) { - return acctest.GetTestProject(is, config) -} - -// AccTestPreCheck ensures at least one of the project env variables is set. -func GetTestProjectNumberFromEnv() string { - return acctest.GetTestProjectNumberFromEnv() -} - -// AccTestPreCheck ensures at least one of the project env variables is set. -func GetTestProjectFromEnv() string { - return acctest.GetTestProjectFromEnv() -} - -// AccTestPreCheck ensures at least one of the credentials env variables is set. -func GetTestCredsFromEnv() string { - return acctest.GetTestCredsFromEnv() -} - -// AccTestPreCheck ensures at least one of the region env variables is set. -func GetTestRegionFromEnv() string { - return acctest.GetTestRegionFromEnv() -} - -func GetTestZoneFromEnv() string { - return acctest.GetTestZoneFromEnv() -} - -func GetTestCustIdFromEnv(t *testing.T) string { - return acctest.GetTestCustIdFromEnv(t) -} - -func GetTestIdentityUserFromEnv(t *testing.T) string { - return acctest.GetTestIdentityUserFromEnv(t) -} - -// Firestore can't be enabled at the same time as Datastore, so we need a new -// project to manage it until we can enable Firestore programmatically. -func GetTestFirestoreProjectFromEnv(t *testing.T) string { - return acctest.GetTestFirestoreProjectFromEnv(t) -} - -// Returns the raw organization id like 1234567890, skipping the test if one is -// not found. -func GetTestOrgFromEnv(t *testing.T) string { - return acctest.GetTestOrgFromEnv(t) -} - -// Alternative to GetTestOrgFromEnv that doesn't need *testing.T -// If using this, you need to process unset values at the call site -func UnsafeGetTestOrgFromEnv() string { - return acctest.UnsafeGetTestOrgFromEnv() -} - -func GetTestOrgDomainFromEnv(t *testing.T) string { - return acctest.GetTestOrgDomainFromEnv(t) -} - -func GetTestOrgTargetFromEnv(t *testing.T) string { - return acctest.GetTestOrgTargetFromEnv(t) -} - -// This is the billing account that will be charged for the infrastructure used during testing. For -// that reason, it is also the billing account used for creating new projects. -func GetTestBillingAccountFromEnv(t *testing.T) string { - return acctest.GetTestBillingAccountFromEnv(t) -} - -// This is the billing account that will be modified to test billing-related functionality. It is -// expected to have more permissions granted to the test user and support subaccounts. -func GetTestMasterBillingAccountFromEnv(t *testing.T) string { - return acctest.GetTestMasterBillingAccountFromEnv(t) -} - -func GetTestServiceAccountFromEnv(t *testing.T) string { - return acctest.GetTestServiceAccountFromEnv(t) -} - -func GetTestPublicAdvertisedPrefixDescriptionFromEnv(t *testing.T) string { - return acctest.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t) -} - -// Some tests fail during VCR. One common case is race conditions when creating resources. -// If a test config adds two fine-grained resources with the same parent it is undefined -// which will be created first, causing VCR to fail ~50% of the time -func SkipIfVcr(t *testing.T) { - acctest.SkipIfVcr(t) -} - -func SleepInSecondsForTest(t int) resource.TestCheckFunc { - return acctest.SleepInSecondsForTest(t) -} - -func SkipIfEnvNotSet(t *testing.T, envs ...string) { - acctest.SkipIfEnvNotSet(t, envs...) -} diff --git a/google/pubsub_utils.go b/google/pubsub_utils.go deleted file mode 100644 index 0f0d9bbe6db..00000000000 --- a/google/pubsub_utils.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/pubsub" -) - -const PubsubTopicRegex = pubsub.PubsubTopicRegex - -func getComputedSubscriptionName(project, subscription string) string { - return pubsub.GetComputedSubscriptionName(project, subscription) -} - -func getComputedTopicName(project, topic string) string { - return pubsub.GetComputedTopicName(project, topic) -} diff --git a/google/regional_utils.go b/google/regional_utils.go deleted file mode 100644 index 4dff164c8f1..00000000000 --- a/google/regional_utils.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -//These functions are used by both the `resource_container_node_pool` and `resource_container_cluster` for handling regional clusters - -// Deprecated: For backward compatibility isZone is still working, -// but all new code should use IsZone in the tpgresource package instead. -func isZone(location string) bool { - return tpgresource.IsZone(location) -} - -// getLocation attempts to get values in this order (if they exist): -// - location argument in the resource config -// - region argument in the resource config -// - zone argument in the resource config -// - zone argument set in the provider config -// -// Deprecated: For backward compatibility getLocation is still working, -// but all new code should use GetLocation in the tpgresource package instead. -func getLocation(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetLocation(d, config) -} - -// getZone reads the "zone" value from the given resource data and falls back -// to provider's value if not given. If neither is provided, returns an error. -// -// Deprecated: For backward compatibility getZone is still working, -// but all new code should use GetZone in the tpgresource package instead. -func getZone(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetZone(d, config) -} diff --git a/google/resource_bigtable_gc_policy.go b/google/resource_bigtable_gc_policy.go deleted file mode 100644 index ca9722ece38..00000000000 --- a/google/resource_bigtable_gc_policy.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "cloud.google.com/go/bigtable" - tpgbigtable "github.com/hashicorp/terraform-provider-google/google/services/bigtable" -) - -// Recursively convert Bigtable GC policy to JSON format in a map. -func gcPolicyToGCRuleString(gc bigtable.GCPolicy, topLevel bool) (map[string]interface{}, error) { - return tpgbigtable.GcPolicyToGCRuleString(gc, topLevel) -} diff --git a/google/resource_bigtable_table.go b/google/resource_bigtable_table.go deleted file mode 100644 index acbb5dbd8a2..00000000000 --- a/google/resource_bigtable_table.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/bigtable" -) - -func flattenColumnFamily(families []string) []map[string]interface{} { - return bigtable.FlattenColumnFamily(families) -} diff --git a/google/resource_cloudfunctions_function.go b/google/resource_cloudfunctions_function.go deleted file mode 100644 index b55976f1d8f..00000000000 --- a/google/resource_cloudfunctions_function.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/cloudfunctions" -) - -type cloudFunctionId = cloudfunctions.CloudFunctionId diff --git a/google/resource_compute_attached_disk.go b/google/resource_compute_attached_disk.go deleted file mode 100644 index cd80d4f0de0..00000000000 --- a/google/resource_compute_attached_disk.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute" - "google.golang.org/api/compute/v1" -) - -func findDiskByName(disks []*compute.AttachedDisk, id string) *compute.AttachedDisk { - return tpgcompute.FindDiskByName(disks, id) -} diff --git a/google/resource_dataflow_job.go b/google/resource_dataflow_job.go deleted file mode 100644 index 2d39e15aac5..00000000000 --- a/google/resource_dataflow_job.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/dataflow" -) - -var dataflowTerminatingStatesMap = dataflow.DataflowTerminatingStatesMap - -var dataflowTerminalStatesMap = dataflow.DataflowTerminalStatesMap diff --git a/google/resource_google_organization_policy.go b/google/resource_google_organization_policy.go deleted file mode 100644 index ebf4aaa4db6..00000000000 --- a/google/resource_google_organization_policy.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" -) - -func canonicalOrgPolicyConstraint(constraint string) string { - return resourcemanager.CanonicalOrgPolicyConstraint(constraint) -} diff --git a/google/resource_google_project.go b/google/resource_google_project.go deleted file mode 100644 index c5b40f202cf..00000000000 --- a/google/resource_google_project.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "google.golang.org/api/cloudresourcemanager/v1" -) - -func PrefixedProject(pid string) string { - return resourcemanager.PrefixedProject(pid) -} - -func parseFolderId(v interface{}) string { - return resourcemanager.ParseFolderId(v) -} - -func EnableServiceUsageProjectServices(services []string, project, billingProject, userAgent string, config *transport_tpg.Config, timeout time.Duration) error { - return resourcemanager.EnableServiceUsageProjectServices(services, project, billingProject, userAgent, config, timeout) -} - -func ListCurrentlyEnabledServices(project, billingProject, userAgent string, config *transport_tpg.Config, timeout time.Duration) (map[string]struct{}, error) { - return resourcemanager.ListCurrentlyEnabledServices(project, billingProject, userAgent, config, timeout) -} - -// Retrieve the existing IAM Policy for a Project -func getProjectIamPolicy(project string, config *transport_tpg.Config) (*cloudresourcemanager.Policy, error) { - return resourcemanager.GetProjectIamPolicy(project, config) -} diff --git a/google/resource_iam_audit_config.go b/google/resource_iam_audit_config.go deleted file mode 100644 index c0bd50cf127..00000000000 --- a/google/resource_iam_audit_config.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" -) - -// Deprecated: For backward compatibility ResourceIamAuditConfig is still working, -// but all new code should use ResourceIamAuditConfig in the tpgiamresource package instead. -func ResourceIamAuditConfig(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc tpgiamresource.NewResourceIamUpdaterFunc, resourceIdParser tpgiamresource.ResourceIdParserFunc, options ...func(*tpgiamresource.IamSettings)) *schema.Resource { - return tpgiamresource.ResourceIamAuditConfig(parentSpecificSchema, newUpdaterFunc, resourceIdParser, options...) -} diff --git a/google/resource_iam_binding.go b/google/resource_iam_binding.go deleted file mode 100644 index ef0cb0018c5..00000000000 --- a/google/resource_iam_binding.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" - "google.golang.org/api/cloudresourcemanager/v1" -) - -// Deprecated: For backward compatibility ResourceIamBinding is still working, -// but all new code should use ResourceIamBinding in the tpgiamresource package instead. -func ResourceIamBinding(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc tpgiamresource.NewResourceIamUpdaterFunc, resourceIdParser tpgiamresource.ResourceIdParserFunc, options ...func(*tpgiamresource.IamSettings)) *schema.Resource { - return tpgiamresource.ResourceIamBinding(parentSpecificSchema, newUpdaterFunc, resourceIdParser, options...) -} - -// Deprecated: For backward compatibility expandIamCondition is still working, -// but all new code should use ExpandIamCondition in the tpgiamresource package instead. -func expandIamCondition(v interface{}) *cloudresourcemanager.Expr { - return tpgiamresource.ExpandIamCondition(v) -} - -// Deprecated: For backward compatibility flattenIamCondition is still working, -// but all new code should use FlattenIamCondition in the tpgiamresource package instead. -func flattenIamCondition(condition *cloudresourcemanager.Expr) []map[string]interface{} { - return tpgiamresource.FlattenIamCondition(condition) -} diff --git a/google/resource_iam_member.go b/google/resource_iam_member.go deleted file mode 100644 index 1737bea7dab..00000000000 --- a/google/resource_iam_member.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" -) - -// Deprecated: For backward compatibility ResourceIamMember is still working, -// but all new code should use ResourceIamMember in the tpgiamresource package instead. -func ResourceIamMember(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc tpgiamresource.NewResourceIamUpdaterFunc, resourceIdParser tpgiamresource.ResourceIdParserFunc, options ...func(*tpgiamresource.IamSettings)) *schema.Resource { - return tpgiamresource.ResourceIamMember(parentSpecificSchema, newUpdaterFunc, resourceIdParser, options...) -} diff --git a/google/resource_iam_policy.go b/google/resource_iam_policy.go deleted file mode 100644 index 3bc82543351..00000000000 --- a/google/resource_iam_policy.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/tpgiamresource" -) - -// Deprecated: For backward compatibility ResourceIamPolicy is still working, -// but all new code should use ResourceIamPolicy in the tpgiamresource package instead. -func ResourceIamPolicy(parentSpecificSchema map[string]*schema.Schema, newUpdaterFunc tpgiamresource.NewResourceIamUpdaterFunc, resourceIdParser tpgiamresource.ResourceIdParserFunc, options ...func(*tpgiamresource.IamSettings)) *schema.Resource { - return tpgiamresource.ResourceIamPolicy(parentSpecificSchema, newUpdaterFunc, resourceIdParser, options...) -} diff --git a/google/resource_logging_exclusion.go b/google/resource_logging_exclusion.go deleted file mode 100644 index 963a50ccabd..00000000000 --- a/google/resource_logging_exclusion.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import "github.com/hashicorp/terraform-provider-google/google/services/logging" - -// parseLoggingExclusionId parses a canonical id into a LoggingExclusionId, or returns an error on failure. -func parseLoggingExclusionId(id string) (*logging.LoggingExclusionId, error) { - return logging.ParseLoggingExclusionId(id) -} diff --git a/google/resource_manager_operation.go b/google/resource_manager_operation.go deleted file mode 100644 index 3149f4243a8..00000000000 --- a/google/resource_manager_operation.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// nolint: deadcode,unused -func ResourceManagerOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - return resourcemanager.ResourceManagerOperationWaitTimeWithResponse(config, op, response, activity, userAgent, timeout) -} - -func ResourceManagerOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - return resourcemanager.ResourceManagerOperationWaitTime(config, op, activity, userAgent, timeout) -} diff --git a/google/resource_service_networking_connection.go b/google/resource_service_networking_connection.go deleted file mode 100644 index 42719b6f3bd..00000000000 --- a/google/resource_service_networking_connection.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/servicenetworking" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -// NOTE(craigatgoogle): An out of band aspect of this API is that it uses a unique formatting of network -// different from the standard self_link URI. It requires a call to the resource manager to get the project -// number for the current project. -func retrieveServiceNetworkingNetworkName(d *schema.ResourceData, config *transport_tpg.Config, network, userAgent string) (string, error) { - return servicenetworking.RetrieveServiceNetworkingNetworkName(d, config, network, userAgent) - -} diff --git a/google/resource_storage_bucket_acl.go b/google/resource_storage_bucket_acl.go deleted file mode 100644 index 79133918307..00000000000 --- a/google/resource_storage_bucket_acl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/storage" -) - -func getRoleEntityPair(role_entity string) (*storage.RoleEntity, error) { - return storage.GetRoleEntityPair(role_entity) -} diff --git a/google/resource_storage_notification.go b/google/resource_storage_notification.go deleted file mode 100644 index 2bbab65420f..00000000000 --- a/google/resource_storage_notification.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/services/storage" -) - -func resourceStorageNotificationParseID(id string) (string, string) { - return storage.ResourceStorageNotificationParseID(id) -} diff --git a/google/retry_utils.go b/google/retry_utils.go deleted file mode 100644 index 332f9bc452a..00000000000 --- a/google/retry_utils.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility retry is still working, -// but all new code should use Retry in the transport_tpg package instead. -func retry(retryFunc func() error) error { - return transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: retryFunc, - }) -} - -// Deprecated: For backward compatibility retryTime is still working, -// but all new code should use RetryTime in the transport_tpg package instead. -func retryTime(retryFunc func() error, minutes int) error { - return RetryTimeDuration(retryFunc, time.Duration(minutes)*time.Minute) -} - -// Deprecated: For backward compatibility RetryTimeDuration is still working, -// but all new code should use RetryTimeDuration in the transport_tpg package instead. -func RetryTimeDuration(retryFunc func() error, duration time.Duration, errorRetryPredicates ...transport_tpg.RetryErrorPredicateFunc) error { - return transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: retryFunc, - Timeout: duration, - ErrorRetryPredicates: errorRetryPredicates, - }) -} - -// Deprecated: For backward compatibility isRetryableError is still working, -// but all new code should use IsRetryableError in the transport_tpg package instead. -func isRetryableError(topErr error, customPredicates ...transport_tpg.RetryErrorPredicateFunc) bool { - return transport_tpg.IsRetryableError(topErr, customPredicates, nil) -} - -// The polling overrides the default backoff logic with max backoff of 10s. The poll interval can be greater than 10s. -// -// Deprecated: For backward compatibility retryWithPolling is still working, -// but all new code should use RetryWithPolling in the transport_tpg package instead. -func retryWithPolling(retryFunc func() (interface{}, error), timeout time.Duration, pollInterval time.Duration, errorRetryPredicates ...transport_tpg.RetryErrorPredicateFunc) (interface{}, error) { - return "", transport_tpg.Retry(transport_tpg.RetryOptions{ - RetryFunc: func() error { - _, err := retryFunc() - return err - }, - Timeout: timeout, - PollInterval: pollInterval, - ErrorRetryPredicates: errorRetryPredicates, - }) -} diff --git a/google/runadminv3_operation.go b/google/runadminv3_operation.go deleted file mode 100644 index 2d76d284b54..00000000000 --- a/google/runadminv3_operation.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/cloudrunv2" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "google.golang.org/api/run/v2" -) - -// Deprecated: For backward compatibility runAdminV2OperationWaitTimeWithResponse is still working, -// but all new code should use RunAdminV2OperationWaitTimeWithResponse in the cloudrunv2 package instead. -func runAdminV2OperationWaitTimeWithResponse(config *transport_tpg.Config, op *run.GoogleLongrunningOperation, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return cloudrunv2.RunAdminV2OperationWaitTimeWithResponse(config, op, response, project, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility runAdminV2OperationWaitTime is still working, -// but all new code should use RunAdminV2OperationWaitTime in the cloudrunv2 package instead. -func runAdminV2OperationWaitTime(config *transport_tpg.Config, op *run.GoogleLongrunningOperation, project, activity, userAgent string, timeout time.Duration) error { - return cloudrunv2.RunAdminV2OperationWaitTime(config, op, project, activity, userAgent, timeout) -} diff --git a/google/self_link_helpers.go b/google/self_link_helpers.go deleted file mode 100644 index f790927d281..00000000000 --- a/google/self_link_helpers.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -// Compare only the resource name of two self links/paths. -// -// Deprecated: For backward compatibility compareResourceNames is still working, -// but all new code should use CompareResourceNames in the tpgresource package instead. -func compareResourceNames(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareResourceNames("", old, new, nil) -} - -// Compare only the relative path of two self links. -// -// Deprecated: For backward compatibility compareSelfLinkRelativePaths is still working, -// but all new code should use CompareSelfLinkRelativePaths in the tpgresource package instead. -func compareSelfLinkRelativePaths(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareSelfLinkRelativePaths("", old, new, nil) -} - -// compareSelfLinkOrResourceName checks if two resources are the same resource -// -// Use this method when the field accepts either a name or a self_link referencing a resource. -// The value we store (i.e. `old` in this method), must be a self_link. -// -// Deprecated: For backward compatibility compareSelfLinkOrResourceName is still working, -// but all new code should use CompareSelfLinkOrResourceName in the tpgresource package instead. -func compareSelfLinkOrResourceName(_, old, new string, _ *schema.ResourceData) bool { - return tpgresource.CompareSelfLinkOrResourceName("", old, new, nil) -} - -// Hash the relative path of a self link. -// -// Deprecated: For backward compatibility selfLinkRelativePathHash is still working, -// but all new code should use SelfLinkRelativePathHash in the tpgresource package instead. -func selfLinkRelativePathHash(selfLink interface{}) int { - return tpgresource.SelfLinkRelativePathHash(selfLink) -} - -// Deprecated: For backward compatibility getRelativePath is still working, -// but all new code should use GetRelativePath in the tpgresource package instead. -func getRelativePath(selfLink string) (string, error) { - return tpgresource.GetRelativePath(selfLink) -} - -// Hash the name path of a self link. -// -// Deprecated: For backward compatibility selfLinkNameHash is still working, -// but all new code should use SelfLinkNameHash in the tpgresource package instead. -func selfLinkNameHash(selfLink interface{}) int { - return tpgresource.SelfLinkNameHash(selfLink) -} - -// Deprecated: For backward compatibility ConvertSelfLinkToV1 is still working, -// but all new code should use ConvertSelfLinkToV1 in the tpgresource package instead. -func ConvertSelfLinkToV1(link string) string { - return tpgresource.ConvertSelfLinkToV1(link) -} - -// Deprecated: For backward compatibility GetResourceNameFromSelfLink is still working, -// but all new code should use Hashcode in the GetResourceNameFromSelfLink package instead. -func GetResourceNameFromSelfLink(link string) string { - return tpgresource.GetResourceNameFromSelfLink(link) -} - -// Deprecated: For backward compatibility NameFromSelfLinkStateFunc is still working, -// but all new code should use NameFromSelfLinkStateFunc in the tpgresource package instead. -func NameFromSelfLinkStateFunc(v interface{}) string { - return tpgresource.NameFromSelfLinkStateFunc(v) -} - -// Deprecated: For backward compatibility StoreResourceName is still working, -// but all new code should use StoreResourceName in the tpgresource package instead. -func StoreResourceName(resourceLink interface{}) string { - return tpgresource.StoreResourceName(resourceLink) -} - -// Deprecated: For backward compatibility GetZonalResourcePropertiesFromSelfLinkOrSchema is still working, -// but all new code should use GetZonalResourcePropertiesFromSelfLinkOrSchema in the tpgresource package instead. -func GetZonalResourcePropertiesFromSelfLinkOrSchema(d *schema.ResourceData, config *transport_tpg.Config) (string, string, string, error) { - return tpgresource.GetZonalResourcePropertiesFromSelfLinkOrSchema(d, config) -} - -// Deprecated: For backward compatibility GetRegionalResourcePropertiesFromSelfLinkOrSchema is still working, -// but all new code should use GetRegionalResourcePropertiesFromSelfLinkOrSchema in the tpgresource package instead. -func GetRegionalResourcePropertiesFromSelfLinkOrSchema(d *schema.ResourceData, config *transport_tpg.Config) (string, string, string, error) { - return tpgresource.GetRegionalResourcePropertiesFromSelfLinkOrSchema(d, config) -} - -// given a full locational (non-global) self link, returns the project + region/zone + name or an error -// -// Deprecated: For backward compatibility GetLocationalResourcePropertiesFromSelfLinkString is still working, -// but all new code should use GetLocationalResourcePropertiesFromSelfLinkString in the tpgresource package instead. -func GetLocationalResourcePropertiesFromSelfLinkString(selfLink string) (string, string, string, error) { - return tpgresource.GetLocationalResourcePropertiesFromSelfLinkString(selfLink) -} - -// This function supports selflinks that have regions and locations in their paths -// -// Deprecated: For backward compatibility GetRegionFromRegionalSelfLink is still working, -// but all new code should use GetRegionFromRegionalSelfLink in the tpgresource package instead. -func GetRegionFromRegionalSelfLink(selfLink string) string { - return tpgresource.GetRegionFromRegionalSelfLink(selfLink) -} diff --git a/google/service_account_waiter.go b/google/service_account_waiter.go deleted file mode 100644 index d24b44d72c6..00000000000 --- a/google/service_account_waiter.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/resourcemanager" - "google.golang.org/api/iam/v1" -) - -func serviceAccountKeyWaitTime(client *iam.ProjectsServiceAccountsKeysService, keyName, publicKeyType, activity string, timeout time.Duration) error { - return resourcemanager.ServiceAccountKeyWaitTime(client, keyName, publicKeyType, activity, timeout) -} diff --git a/google/service_networking_operation.go b/google/service_networking_operation.go deleted file mode 100644 index c8b1be73958..00000000000 --- a/google/service_networking_operation.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - tpgservicenetworking "github.com/hashicorp/terraform-provider-google/google/services/servicenetworking" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "google.golang.org/api/servicenetworking/v1" -) - -// Deprecated: For backward compatibility ServiceNetworkingOperationWaitTime is still working, -// but all new code should use ServiceNetworkingOperationWaitTime in the tpgservicenetworking package instead. -func ServiceNetworkingOperationWaitTime(config *transport_tpg.Config, op *servicenetworking.Operation, activity, userAgent, project string, timeout time.Duration) error { - return tpgservicenetworking.ServiceNetworkingOperationWaitTime(config, op, activity, userAgent, project, timeout) -} diff --git a/google/service_scope.go b/google/service_scope.go deleted file mode 100644 index 7fd9a9e5afc..00000000000 --- a/google/service_scope.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -func canonicalizeServiceScope(scope string) string { - return tpgresource.CanonicalizeServiceScope(scope) -} - -func canonicalizeServiceScopes(scopes []string) []string { - return tpgresource.CanonicalizeServiceScopes(scopes) -} - -func stringScopeHashcode(v interface{}) int { - return tpgresource.StringScopeHashcode(v) -} diff --git a/google/serviceman_operation.go b/google/serviceman_operation.go deleted file mode 100644 index e59920f10ac..00000000000 --- a/google/serviceman_operation.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - tpgservicemanagement "github.com/hashicorp/terraform-provider-google/google/services/servicemanagement" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "google.golang.org/api/googleapi" - "google.golang.org/api/servicemanagement/v1" -) - -// Deprecated: For backward compatibility ServiceManagementOperationWaitTime is still working, -// but all new code should use ServiceManagementOperationWaitTime in the tpgservicemanagement package instead. -func ServiceManagementOperationWaitTime(config *transport_tpg.Config, op *servicemanagement.Operation, activity, userAgent string, timeout time.Duration) (googleapi.RawMessage, error) { - return tpgservicemanagement.ServiceManagementOperationWaitTime(config, op, activity, userAgent, timeout) -} diff --git a/google/services/dataplex/resource_dataplex_task_test.go b/google/services/dataplex/resource_dataplex_task_test.go index 4eb8ef88516..52eda3d98d4 100644 --- a/google/services/dataplex/resource_dataplex_task_test.go +++ b/google/services/dataplex/resource_dataplex_task_test.go @@ -1,22 +1,5 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -// ---------------------------------------------------------------------------- -// -// *** AUTO GENERATED CODE *** Type: MMv1 *** -// -// ---------------------------------------------------------------------------- -// -// This file is automatically generated by Magic Modules and manual -// changes will be clobbered when the file is regenerated. -// -// Please read more about how to change this file in -// .github/CONTRIBUTING.md. -// -// ---------------------------------------------------------------------------- - package dataplex_test import ( @@ -25,13 +8,14 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" ) func TestAccDataplexTaskDataplexTask_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "project_name": acctest.GetTestProjectFromEnv(), + "project_name": envvar.GetTestProjectFromEnv(), "random_suffix": acctest.RandString(t, 10), } diff --git a/google/services/resourcemanager/resource_google_project_iam_member_test.go b/google/services/resourcemanager/resource_google_project_iam_member_test.go index 6dbd4bd6861..0a390a73e59 100644 --- a/google/services/resourcemanager/resource_google_project_iam_member_test.go +++ b/google/services/resourcemanager/resource_google_project_iam_member_test.go @@ -57,7 +57,7 @@ func TestAccProjectIamMember_multiple(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_ORG") + envvar.SkipIfEnvNotSet(t, "GOOGLE_ORG") pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "google_project_iam_member.acceptance" @@ -100,7 +100,7 @@ func TestAccProjectIamMember_remove(t *testing.T) { t.Parallel() org := envvar.GetTestOrgFromEnv(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_ORG") + envvar.SkipIfEnvNotSet(t, "GOOGLE_ORG") pid := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) resourceName := "google_project_iam_member.acceptance" diff --git a/google/services/resourcemanager/resource_google_project_test.go b/google/services/resourcemanager/resource_google_project_test.go index 37e7e1e8f9b..77fc4975ae2 100644 --- a/google/services/resourcemanager/resource_google_project_test.go +++ b/google/services/resourcemanager/resource_google_project_test.go @@ -77,7 +77,7 @@ func TestAccProject_billing(t *testing.T) { org := envvar.GetTestOrgFromEnv(t) // This is a second billing account that can be charged, which is used only in this test to // verify that a project can update its billing account. - acctest.SkipIfEnvNotSet(t, "GOOGLE_BILLING_ACCOUNT_2") + envvar.SkipIfEnvNotSet(t, "GOOGLE_BILLING_ACCOUNT_2") billingId2 := os.Getenv("GOOGLE_BILLING_ACCOUNT_2") billingId := envvar.GetTestBillingAccountFromEnv(t) pid := fmt.Sprintf("%s-%d", TestPrefix, acctest.RandInt(t)) diff --git a/google/services/storage/resource_storage_bucket_acl_test.go b/google/services/storage/resource_storage_bucket_acl_test.go index 4bf7deee5e3..4b71480d378 100644 --- a/google/services/storage/resource_storage_bucket_acl_test.go +++ b/google/services/storage/resource_storage_bucket_acl_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" "github.com/hashicorp/terraform-provider-google/google/services/storage" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -30,7 +31,7 @@ func TestAccStorageBucketAcl_basic(t *testing.T) { t.Parallel() bucketName := acctest.TestBucketName(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -51,7 +52,7 @@ func TestAccStorageBucketAcl_upgrade(t *testing.T) { t.Parallel() bucketName := acctest.TestBucketName(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -89,7 +90,7 @@ func TestAccStorageBucketAcl_upgradeSingleUser(t *testing.T) { t.Parallel() bucketName := acctest.TestBucketName(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -127,7 +128,7 @@ func TestAccStorageBucketAcl_downgrade(t *testing.T) { t.Parallel() bucketName := acctest.TestBucketName(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), @@ -182,7 +183,7 @@ func TestAccStorageBucketAcl_unordered(t *testing.T) { t.Parallel() bucketName := acctest.TestBucketName(t) - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT_NUMBER") acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), diff --git a/google/services/storage/resource_storage_notification_test.go b/google/services/storage/resource_storage_notification_test.go index 95beb97904a..fa07ead4d1d 100644 --- a/google/services/storage/resource_storage_notification_test.go +++ b/google/services/storage/resource_storage_notification_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" tpgstorage "github.com/hashicorp/terraform-provider-google/google/services/storage" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -23,7 +24,7 @@ var ( func TestAccStorageNotification_basic(t *testing.T) { t.Parallel() - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT") var notification storage.Notification bucketName := acctest.TestBucketName(t) @@ -67,7 +68,7 @@ func TestAccStorageNotification_basic(t *testing.T) { func TestAccStorageNotification_withEventsAndAttributes(t *testing.T) { t.Parallel() - acctest.SkipIfEnvNotSet(t, "GOOGLE_PROJECT") + envvar.SkipIfEnvNotSet(t, "GOOGLE_PROJECT") var notification storage.Notification bucketName := acctest.TestBucketName(t) diff --git a/google/sqladmin_operation.go b/google/sqladmin_operation.go deleted file mode 100644 index 8676d5d5919..00000000000 --- a/google/sqladmin_operation.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/sql" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility SqlAdminOperationWaitTime is still working, -// but all new code should use SqlAdminOperationWaitTime in the sql package instead. -func SqlAdminOperationWaitTime(config *transport_tpg.Config, res interface{}, project, activity, userAgent string, timeout time.Duration) error { - return sql.SqlAdminOperationWaitTime(config, res, project, activity, userAgent, timeout) -} - -// Retry if Cloud SQL operation returns a 429 with a specific message for -// concurrent operations. -// -// Deprecated: For backward compatibility IsSqlInternalError is still working, -// but all new code should use IsSqlInternalError in the sql package instead. -func IsSqlInternalError(err error) (bool, string) { - return sql.IsSqlInternalError(err) -} diff --git a/google/stateful_mig_polling.go b/google/stateful_mig_polling.go deleted file mode 100644 index 24ab5c5192c..00000000000 --- a/google/stateful_mig_polling.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility PollCheckInstanceConfigDeleted is still working, -// but all new code should use PollCheckInstanceConfigDeleted in the tpgcompute package instead. -func PollCheckInstanceConfigDeleted(resp map[string]interface{}, respErr error) transport_tpg.PollResult { - return tpgcompute.PollCheckInstanceConfigDeleted(resp, respErr) -} diff --git a/google/tags_location_operation.go b/google/tags_location_operation.go deleted file mode 100644 index 42c1ae124d5..00000000000 --- a/google/tags_location_operation.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/tags" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// Deprecated: For backward compatibility TagsLocationOperationWaitTimeWithResponse is still working, -// but all new code should use TagsLocationOperationWaitTimeWithResponse in the tags package instead. -func TagsLocationOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - return tags.TagsLocationOperationWaitTimeWithResponse(config, op, response, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility TagsLocationOperationWaitTime is still working, -// but all new code should use TagsLocationOperationWaitTime in the tags package instead. -func TagsLocationOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error { - return tags.TagsLocationOperationWaitTime(config, op, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility GetLocationFromOpName is still working, -// but all new code should use GetLocationFromOpName in the tags package instead. -func GetLocationFromOpName(opName string) string { - return tags.GetLocationFromOpName(opName) -} diff --git a/google/test-fixtures/apigateway/api_descriptor.pb b/google/test-fixtures/apigateway/api_descriptor.pb deleted file mode 100644 index c288275adb1..00000000000 Binary files a/google/test-fixtures/apigateway/api_descriptor.pb and /dev/null differ diff --git a/google/test-fixtures/apigateway/bookstore.proto b/google/test-fixtures/apigateway/bookstore.proto deleted file mode 100644 index c3f685f1a0c..00000000000 --- a/google/test-fixtures/apigateway/bookstore.proto +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -syntax = "proto3"; - -package endpoints.examples.bookstore; - -option java_multiple_files = true; -option java_outer_classname = "BookstoreProto"; -option java_package = "com.google.endpoints.examples.bookstore"; - - -import "google/protobuf/empty.proto"; - -// A simple Bookstore API. -// -// The API manages shelves and books resources. Shelves contain books. -service Bookstore { - // Returns a list of all shelves in the bookstore. - rpc ListShelves(google.protobuf.Empty) returns (ListShelvesResponse) {} - // Creates a new shelf in the bookstore. - rpc CreateShelf(CreateShelfRequest) returns (Shelf) {} - // Returns a specific bookstore shelf. - rpc GetShelf(GetShelfRequest) returns (Shelf) {} - // Deletes a shelf, including all books that are stored on the shelf. - rpc DeleteShelf(DeleteShelfRequest) returns (google.protobuf.Empty) {} - // Returns a list of books on a shelf. - rpc ListBooks(ListBooksRequest) returns (ListBooksResponse) {} - // Creates a new book. - rpc CreateBook(CreateBookRequest) returns (Book) {} - // Returns a specific book. - rpc GetBook(GetBookRequest) returns (Book) {} - // Deletes a book from a shelf. - rpc DeleteBook(DeleteBookRequest) returns (google.protobuf.Empty) {} -} - -// A shelf resource. -message Shelf { - // A unique shelf id. - int64 id = 1; - // A theme of the shelf (fiction, poetry, etc). - string theme = 2; -} - -// A book resource. -message Book { - // A unique book id. - int64 id = 1; - // An author of the book. - string author = 2; - // A book title. - string title = 3; -} - -// Response to ListShelves call. -message ListShelvesResponse { - // Shelves in the bookstore. - repeated Shelf shelves = 1; -} - -// Request message for CreateShelf method. -message CreateShelfRequest { - // The shelf resource to create. - Shelf shelf = 1; -} - -// Request message for GetShelf method. -message GetShelfRequest { - // The ID of the shelf resource to retrieve. - int64 shelf = 1; -} - -// Request message for DeleteShelf method. -message DeleteShelfRequest { - // The ID of the shelf to delete. - int64 shelf = 1; -} - -// Request message for ListBooks method. -message ListBooksRequest { - // ID of the shelf which books to list. - int64 shelf = 1; -} - -// Response message to ListBooks method. -message ListBooksResponse { - // The books on the shelf. - repeated Book books = 1; -} - -// Request message for CreateBook method. -message CreateBookRequest { - // The ID of the shelf on which to create a book. - int64 shelf = 1; - // A book resource to create on the shelf. - Book book = 2; -} - -// Request message for GetBook method. -message GetBookRequest { - // The ID of the shelf from which to retrieve a book. - int64 shelf = 1; - // The ID of the book to retrieve. - int64 book = 2; -} - -// Request message for DeleteBook method. -message DeleteBookRequest { - // The ID of the shelf from which to delete a book. - int64 shelf = 1; - // The ID of the book to delete. - int64 book = 2; -} diff --git a/google/test-fixtures/apigateway/openapi.yaml b/google/test-fixtures/apigateway/openapi.yaml deleted file mode 100644 index 2dd9d843f83..00000000000 --- a/google/test-fixtures/apigateway/openapi.yaml +++ /dev/null @@ -1,21 +0,0 @@ -swagger: '2.0' -info: - title: dev - description: Sample API on API Gateway with a Cloud Run backend - version: 1.0.0 -schemes: - - https -produces: - - application/json -paths: - /hello: - get: - summary: Greet a user - operationId: hello - x-google-backend: - address: https://google.com - responses: - '200': - description: A successful response - schema: - type: string \ No newline at end of file diff --git a/google/test-fixtures/apigee/apigee_keystore_alias_test_cert.pem b/google/test-fixtures/apigee/apigee_keystore_alias_test_cert.pem deleted file mode 100644 index 3d671aa19ec..00000000000 --- a/google/test-fixtures/apigee/apigee_keystore_alias_test_cert.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDazCCAlOgAwIBAgIUJNAqHD7RXfTuDfK5v+58K+YygS4wDQYJKoZIhvcNAQEL -BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM -GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMzAzMjEwNDQyMzVaFw0yNTEy -MTYwNDQyMzVaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw -HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQC/XVbAB3l6cnizpofzSJ5o4Iko3WgNV1PNeTe/JvZP -zSoJC22TY3foqrtM0YBdNWfBEKyT5bTGYLJ67P9v2CX4xfUtQHiuWkF1OaA8/umb -vzaQt2V1XsPC4nlnByeL8nT9wtLEwZ/8qeYJ0c0PS+1zJ5kEVRCvTg3ay6o7VZv5 -t3TvaQBjNwAhaUlFw9R6tqCG7Ztt+4d8dxCV4LjC6ygHtzjfmJQJBgMJcCB3F0ch -FMGFz9I4OGXrqukzuSJLMg/Nok3EkOV7b4vptdICfzJJTDfvyQ9radzC+O7mtnRp -uYGdTFKbDOglwxliyJJuQ+GAWjaW2sM51EM6AIk88bylAgMBAAGjUzBRMB0GA1Ud -DgQWBBT9f1xhI06cdr9fhizBFmmQlQQN0DAfBgNVHSMEGDAWgBT9f1xhI06cdr9f -hizBFmmQlQQN0DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCH -u+hNGEpv6v0Cv/tFERye3mWkFWlcuRcmot+vOLVeuJ/Tq2/4/ZLJXjys/2+1lzDW -bvkJjsyrAApKur7fZKy4EbT4FlCgxCfL7W7eyflV+a3Z7mQTohqB4V/hbh+jY08r -JkLnTwtV2GWctI6vkXZAJcBi/Gaqj3OZUUa7vnq9U7xD9C6D/W3c27zK412CXHjh -PvCkD6SrdevG65EZOIVcIUIkEGcHbwbVnkYkjUoOCs61Qplch13zZX3IWPUCNaQI -q/LPc+CVH4t6Eao9XFt5HEPA2wjyh91m9yO0lB7pcfm5c0b7EhDRFxSFg2yzMroy -9nX6pQjq4qys/j+CL0RP ------END CERTIFICATE----- diff --git a/google/test-fixtures/apigee/apigee_keystore_alias_test_cert2.pem b/google/test-fixtures/apigee/apigee_keystore_alias_test_cert2.pem deleted file mode 100644 index 060650f3edf..00000000000 --- a/google/test-fixtures/apigee/apigee_keystore_alias_test_cert2.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDazCCAlOgAwIBAgIUfCJocHZRYbgzWUuaP6j9HM4Fp9YwDQYJKoZIhvcNAQEL -BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM -GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMzAzMjExNjM2MDFaFw0yNTEy -MTYxNjM2MDFaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw -HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQC/XVbAB3l6cnizpofzSJ5o4Iko3WgNV1PNeTe/JvZP -zSoJC22TY3foqrtM0YBdNWfBEKyT5bTGYLJ67P9v2CX4xfUtQHiuWkF1OaA8/umb -vzaQt2V1XsPC4nlnByeL8nT9wtLEwZ/8qeYJ0c0PS+1zJ5kEVRCvTg3ay6o7VZv5 -t3TvaQBjNwAhaUlFw9R6tqCG7Ztt+4d8dxCV4LjC6ygHtzjfmJQJBgMJcCB3F0ch -FMGFz9I4OGXrqukzuSJLMg/Nok3EkOV7b4vptdICfzJJTDfvyQ9radzC+O7mtnRp -uYGdTFKbDOglwxliyJJuQ+GAWjaW2sM51EM6AIk88bylAgMBAAGjUzBRMB0GA1Ud -DgQWBBT9f1xhI06cdr9fhizBFmmQlQQN0DAfBgNVHSMEGDAWgBT9f1xhI06cdr9f -hizBFmmQlQQN0DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQA+ -Z6i9ZdOMBUA0yYvE7xVVNiMwV+7N0cnL05JR6KuvDRkVL4j1l2D4tGSmP1AsD3I8 -4ozLPtQ0Dk407KSN/X3Tg+vd4yHefEq4yOZlHbEV+YcDgix8svvPLA8B9lSuhnne -Z4byRYaSAhhMiiEBQTMBjaAIjcFiif3g079NbeGopQjrvUTR67Hb8JfmIhZ6icbh -5VoihAPsRno3Tjg+5z7E1nEY3zW+VK9rp1HqFIDazwAQSUFpM/GVn+HemMS7optR -jEMhkqAS4E/+GUGAxWhfeQC4kZKJL2JgiNaCghEugGY7UWemXGPRcgN87UtTLqg6 -6FW15bRjDzogPB6Kell5 ------END CERTIFICATE----- diff --git a/google/test-fixtures/apigee/apigee_keystore_alias_test_key.pem b/google/test-fixtures/apigee/apigee_keystore_alias_test_key.pem deleted file mode 100644 index 7e9a121f50a..00000000000 --- a/google/test-fixtures/apigee/apigee_keystore_alias_test_key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC/XVbAB3l6cniz -pofzSJ5o4Iko3WgNV1PNeTe/JvZPzSoJC22TY3foqrtM0YBdNWfBEKyT5bTGYLJ6 -7P9v2CX4xfUtQHiuWkF1OaA8/umbvzaQt2V1XsPC4nlnByeL8nT9wtLEwZ/8qeYJ -0c0PS+1zJ5kEVRCvTg3ay6o7VZv5t3TvaQBjNwAhaUlFw9R6tqCG7Ztt+4d8dxCV -4LjC6ygHtzjfmJQJBgMJcCB3F0chFMGFz9I4OGXrqukzuSJLMg/Nok3EkOV7b4vp -tdICfzJJTDfvyQ9radzC+O7mtnRpuYGdTFKbDOglwxliyJJuQ+GAWjaW2sM51EM6 -AIk88bylAgMBAAECggEAIjXJgGLVsLIuKc+nljJxP0aEvq12IIxwCteUw7NvbSy8 -Swmj+SlbElkTStRZIlCdz8HvWDFEdAJtZdRghdoaT7Lz9bcE3AZ+lTpMDxtzH8i7 -NHvUw3rBfGGIWobI5xfdGlBt5YbH1x94ZGEBS67DMEbv7/pVFUHa8DZgpGLVk3qN -SGlWCRUh3VkodpukhWya3tUNU8289IQr5BOaBYgsTM03kV0RG2sjhNNKEA4J2cXm -2ZI5KlQIWIPJFWZPmOoqqBgeY/y3L8gZ3BmpVHcV0D22cPAQuODV0T5ByUnPDVMj -jbYeFIgZ2Hw65pnYxHISxLcDyi9aDYYvlh4a51WfgQKBgQDpndfBzn7ecoPpu5vP -mwQ15kwEE7R9KA8GQbn+6gUVcpMvvbL9ggwkEIOHn1VWmCxNvZJ2UVyJtUXrpP82 -yaX/0YCTNpuayxQ1kT27IFIg9rsYvMxapxI8aZaMFOyLHnpuEMNLTeXHra9MP3R0 -5HUCSoZC+ckivvavMbpSs7c2vQKBgQDRsyNTrejAAEnYgkmwEhprE6dbM5QzGNxz -YVwriEQqEod9q4p2Fy8I1rBQZqhKCdTF85FK2KxuEv5u5E5OdjvWQBHazbGSyNhJ -OxzPhGKB/4uk9BcnEWWNQAlB4QFnbwiEtzz+VBjqcSCTTbO/Ln+dmRPU0mcZxknB -6WJr6DkQCQKBgGWJGPE/Ep0UIIlB5SKCOX5Drd5HwjZzZrRNdM16YONFfPtO87CD -CUvTcZdMhQax9O+E6VdLXXDsvIsCl3n0gpWBNOTG4zKP+SSfD7l4/rkdA4xo4li0 -LJTdP3V60qRUhtm3p2nfXXM/5eS535++e6yXP2t0rRrQ7N6QOm8fdQ3xAoGARpXy -Ejy718VBFivk+eteESTwdHaMMBbyPbRL/itEJpVOHjMbzFxJbMQ3XRjxFNryUB+I -jJUalYK3OkSHR0ntIlU2rVwHpc0NYLkRHZkGP5PxQXkYQgJNGJqxgwdmHZb2WxYC -5ekQ6fliabMCChxwwG/CiSS5p6djNG6GvqPQcWECgYAMk7VtmPdahOgypfb370We -lKCCCjXL7GPvhTXojXvdym3M8vNsPGVwY0W0KDxqqIvbZZqmpGtFh1ajoQKQZbE/ -6yG0vHLO4FbizpbapepB5wbceLqXG7AeCUyNvcJnXssH7SRYFJpZwwWOrF2RZcKF -RKvaC/HGRucKteI9gBfsjA== ------END PRIVATE KEY----- diff --git a/google/test-fixtures/apigee/apigee_sharedflow_bundle.zip b/google/test-fixtures/apigee/apigee_sharedflow_bundle.zip deleted file mode 100644 index 52f1c94091b..00000000000 Binary files a/google/test-fixtures/apigee/apigee_sharedflow_bundle.zip and /dev/null differ diff --git a/google/test-fixtures/apigee/apigee_sharedflow_bundle2.zip b/google/test-fixtures/apigee/apigee_sharedflow_bundle2.zip deleted file mode 100644 index 6e15c111403..00000000000 Binary files a/google/test-fixtures/apigee/apigee_sharedflow_bundle2.zip and /dev/null differ diff --git a/google/test-fixtures/apigee/keyStore.p12 b/google/test-fixtures/apigee/keyStore.p12 deleted file mode 100644 index 9df4f461f5f..00000000000 Binary files a/google/test-fixtures/apigee/keyStore.p12 and /dev/null differ diff --git a/google/test-fixtures/appengine/hello-world-flask/app.yaml b/google/test-fixtures/appengine/hello-world-flask/app.yaml deleted file mode 100644 index 645bd4a00f7..00000000000 --- a/google/test-fixtures/appengine/hello-world-flask/app.yaml +++ /dev/null @@ -1,18 +0,0 @@ - -runtime: python -env: flex -entrypoint: gunicorn -b :$PORT main:app - -runtime_config: - python_version: 3 - -# This sample incurs costs to run on the App Engine flexible environment. -# The settings below are to reduce costs during testing and are not appropriate -# for production use. For more information, see: -# https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml -manual_scaling: - instances: 1 -resources: - cpu: 1 - memory_gb: 0.5 - disk_size_gb: 10 \ No newline at end of file diff --git a/google/test-fixtures/appengine/hello-world-flask/main.py b/google/test-fixtures/appengine/hello-world-flask/main.py deleted file mode 100644 index 0d231f3236e..00000000000 --- a/google/test-fixtures/appengine/hello-world-flask/main.py +++ /dev/null @@ -1,36 +0,0 @@ -import logging - -from flask import Flask - - -app = Flask(__name__) - - -@app.route('/') -def hello(): - """Return a friendly HTTP greeting.""" - return 'Hello World!' - -@app.route('/alive') -def alive(): - """Liveness check.""" - return 'Alive!' - -@app.route('/ready') -def ready(): - """Readiness check.""" - return 'Ready!' - -@app.errorhandler(500) -def server_error(e): - logging.exception('An error occurred during a request.') - return """ - An internal error occurred:
{}
- See logs for full stacktrace. - """.format(e), 500 - - -if __name__ == '__main__': - # This is used when running locally. Gunicorn is used to run the - # application on Google App Engine. See entrypoint in app.yaml. - app.run(host='127.0.0.1', port=8080, debug=True) \ No newline at end of file diff --git a/google/test-fixtures/appengine/hello-world-flask/requirements.txt b/google/test-fixtures/appengine/hello-world-flask/requirements.txt deleted file mode 100644 index f358d0ad8e4..00000000000 --- a/google/test-fixtures/appengine/hello-world-flask/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -Flask==1.1.1 -gunicorn==20.0.4 \ No newline at end of file diff --git a/google/test-fixtures/appengine/hello-world.zip b/google/test-fixtures/appengine/hello-world.zip deleted file mode 100644 index 658a65aed10..00000000000 Binary files a/google/test-fixtures/appengine/hello-world.zip and /dev/null differ diff --git a/google/test-fixtures/bigquerytable/avro-generated.avro b/google/test-fixtures/bigquerytable/avro-generated.avro deleted file mode 100644 index c10ee312e51..00000000000 Binary files a/google/test-fixtures/bigquerytable/avro-generated.avro and /dev/null differ diff --git a/google/test-fixtures/bigquerytable/simple/data/00000-0-4e4a11ad-368c-496b-97ae-e3ac28051a4d-00001.parquet b/google/test-fixtures/bigquerytable/simple/data/00000-0-4e4a11ad-368c-496b-97ae-e3ac28051a4d-00001.parquet deleted file mode 100644 index 3d7d5cecd19..00000000000 Binary files a/google/test-fixtures/bigquerytable/simple/data/00000-0-4e4a11ad-368c-496b-97ae-e3ac28051a4d-00001.parquet and /dev/null differ diff --git a/google/test-fixtures/bigquerytable/simple/metadata/00000-1114da6b-bb88-4b5a-94bd-370f286c858a.metadata.json b/google/test-fixtures/bigquerytable/simple/metadata/00000-1114da6b-bb88-4b5a-94bd-370f286c858a.metadata.json deleted file mode 100644 index 732b1ef7af8..00000000000 --- a/google/test-fixtures/bigquerytable/simple/metadata/00000-1114da6b-bb88-4b5a-94bd-370f286c858a.metadata.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "format-version": 1, - "table-uuid": "20f6c20d-d535-4c0c-be82-cb25d31e9250", - "location": "/home/iceberg/warehouse/simple", - "last-updated-ms": 1686356696798, - "last-column-id": 2, - "schema": { - "type": "struct", - "schema-id": 0, - "fields": [ - { - "id": 1, - "name": "one", - "required": false, - "type": "string" - }, - { - "id": 2, - "name": "two", - "required": false, - "type": "long" - } - ] - }, - "current-schema-id": 0, - "schemas": [ - { - "type": "struct", - "schema-id": 0, - "fields": [ - { - "id": 1, - "name": "one", - "required": false, - "type": "string" - }, - { - "id": 2, - "name": "two", - "required": false, - "type": "long" - } - ] - } - ], - "partition-spec": [], - "default-spec-id": 0, - "partition-specs": [ - { - "spec-id": 0, - "fields": [] - } - ], - "last-partition-id": 999, - "default-sort-order-id": 0, - "sort-orders": [ - { - "order-id": 0, - "fields": [] - } - ], - "properties": { - "owner": "root" - }, - "current-snapshot-id": -1, - "refs": {}, - "snapshots": [], - "snapshot-log": [], - "metadata-log": [] -} \ No newline at end of file diff --git a/google/test-fixtures/bigquerytable/test.parquet.gzip b/google/test-fixtures/bigquerytable/test.parquet.gzip deleted file mode 100644 index b0681f33d75..00000000000 Binary files a/google/test-fixtures/bigquerytable/test.parquet.gzip and /dev/null differ diff --git a/google/test-fixtures/binauthz/generated_payload.json.tmpl b/google/test-fixtures/binauthz/generated_payload.json.tmpl deleted file mode 100644 index 3db3c90fe98..00000000000 --- a/google/test-fixtures/binauthz/generated_payload.json.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -{ - "critical": { - "identity": { - "docker-reference": "%s" - }, - "image": { - "%s" - }, - "type": "Google cloud binauthz container signature" - } -} - diff --git a/google/test-fixtures/certificatemanager/cert.pem b/google/test-fixtures/certificatemanager/cert.pem deleted file mode 100644 index ac1e3643825..00000000000 --- a/google/test-fixtures/certificatemanager/cert.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDDzCCAfegAwIBAgIUDOiCLH9QNMMYnjPZVf4VwO9blsEwDQYJKoZIhvcNAQEL -BQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wIBcNMjIwODI0MDg0MDUxWhgPMzAy -MTEyMjUwODQwNTFaMBYxFDASBgNVBAMMC2V4YW1wbGUuY29tMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvOT925GG4lKV9HvAHsbecMhGPAqjhVRC26iZ -UJC8oSWOu95lWJSX5ZhbiF6Nz192wDGV/VAh3Lxj8RYtcn75eDxQKTcKouDld+To -CGIStPFWbR6rbysLuZqFVEXVOTvp2QIegInfrvnGC4j7Qpic7zrFB9HzJx+0HpeE -yO4gkdzJfEK/gMmolUgJrKX59o+0+Rj+Jq3EtcQxL1fVBVJSx0NvpoR1eYpnHMr/ -rJKZkUUZ2xE86hrtpiP6OEYQTi00rmf4GnZF5QfGGD0xuoQXtR7Tu+XhKibXIhxc -D4RzPLX1QS040PXvmMPLDb4YlUQ6V3Rs42JDvkkDwIMXZvn8awIDAQABo1MwUTAd -BgNVHQ4EFgQURuo1CCZZAUv7xi02f2nC5tRbf18wHwYDVR0jBBgwFoAURuo1CCZZ -AUv7xi02f2nC5tRbf18wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC -AQEAqx3tDxurnYr9EUPhF5/LlDPYM+VI7EgrKdRnuIqUlZI0tm3vOGME0te6dBTC -YLNaHLW3m/4Tm4M2eg0Kpz6CxJfn3109G31dCi0xwzSDHf5TPUWvqIVhq5WRgMIf -n8KYBlQSmqdJBRztUIQH/UPFnSbxymlS4s5qwDgTH5ag9EEBcnWsQ2LZjKi0eqve -MaqAvvB+j8RGZzYY4re94bSJI42zIZ6nMWPtXwRuDc30xl/u+E0jWIgWbPwSd6Km -3wnJnGiU2ezPGq3zEU+Rc39VVIFKQpciNeYuF3neHPJvYOf58qW2Z8s0VH0MR1x3 -3DoO/e30FIr9j+PRD+s5BPKF2A== ------END CERTIFICATE----- diff --git a/google/test-fixtures/certificatemanager/private-key.pem b/google/test-fixtures/certificatemanager/private-key.pem deleted file mode 100644 index b5d085cff07..00000000000 --- a/google/test-fixtures/certificatemanager/private-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC85P3bkYbiUpX0 -e8Aext5wyEY8CqOFVELbqJlQkLyhJY673mVYlJflmFuIXo3PX3bAMZX9UCHcvGPx -Fi1yfvl4PFApNwqi4OV35OgIYhK08VZtHqtvKwu5moVURdU5O+nZAh6Aid+u+cYL -iPtCmJzvOsUH0fMnH7Qel4TI7iCR3Ml8Qr+AyaiVSAmspfn2j7T5GP4mrcS1xDEv -V9UFUlLHQ2+mhHV5imccyv+skpmRRRnbETzqGu2mI/o4RhBOLTSuZ/gadkXlB8YY -PTG6hBe1HtO75eEqJtciHFwPhHM8tfVBLTjQ9e+Yw8sNvhiVRDpXdGzjYkO+SQPA -gxdm+fxrAgMBAAECggEAV4/A24TQpV4KFBw/WSTvnRFBeXinB1mhamhztWR6hCrA -SPcVPKQY632eRI8sJmpGxl3V/Ogl4khT/cA9jfstEl7G++v/WrRsupCaPLSVnlnX -KdsTNgOauk1WK9P5PMA4rPcuA4Cl91riQpubeWn8KWsxRWg90i+Ak8PB8lBsOaB1 -QzjigWlrRWSpodaw0MBIMZFDL2BYK8HEr+wyATYIyGvDQc9zCnMQIQIZyEPYepLO -04Dw17YcjgnoJ5gLAFiTvDrCpTMewud1RQzvW5TAvG2piw34sf3QMGPM7aXNrfuZ -4ZPC/MwVQgq9Nc+jeDsjApQmJKJ+3a8OdIPU89ArTQKBgQDCpHHQe1RzpHmIx47/ -9N5r+NPBhh8flDYmvgi6zPeBfrAaLWhidS8c7Voa6HwvMxbhryDEvc0YqI3vllfy -xnRF+DfSryozW0gjrkXDGoOzqOJ3EuQwLSJnyX6La2lmufqsRFazwYJ5sxcjoGHK -/sbwZkIUj1ejuH44ve+ZJQFfpwKBgQD4cLJrJhqImUDhHZRx9jBvxyeHy/RjmHK6 -70xQVDi9ZqeExHwtoSbolhXKLB1RtBnw+t5Csy7IDNBDsbUg9fXU8KyCTIdmsyws -bDb5hdKsUF76rkKzlpttiXMRVWGS3CMKWahBpnL3lFB3tdtmskemkBTXVn4VgKAH -xk9XnZ11nQKBgDbQSJ0FnkrSzscOK984/ko50Kh3NNyXyIgwjBTPFASLwNweXX8c -sR/cV7usLQy9vnvf7cJ6EQAYt5/5Httnt+bceBwE6EV+N1qVAWBoXx6BOQV/dHN8 -wmun+tMYdJ5RUZ6hwCjvHedX3/RQfjnEdhHNOl6/31Zj5mfkVU0zdqeRAoGAcvIh -erXMfPr7K6y16+xOCMmKHqhc0F/OZXMmSdxNzEPcqe8GzU3MZLxcJIg4oH7FqdtI -Tm/86w4Spd9owHFMZlNcXYTu+LNZcsw2u0gRayxcZXuO3OyHySxZEuIAHSTBCZ7l -3EoY0zfJ6zk249MEl6n+GouoFmbGpBI6z3zbR3kCgYEAlCNZVH4uJrP5beTOZTTR -VJRk7BXvEC6HsM140YtIN7NHy2GtzrgmmY/ZAFB/hX8Ft4ex2MxbIp3hvxroTqGn -bfu7uv97NoPQqbjtc3Mz8h2IaXTVDUnWYY5gDu6rM2w+Z75/sWIGiTWrsdYX4ohb -ujngzJ7Ew7GgKSboj6mtlVM= ------END PRIVATE KEY----- \ No newline at end of file diff --git a/google/test-fixtures/cloudfunctions/bucket_trigger.js b/google/test-fixtures/cloudfunctions/bucket_trigger.js deleted file mode 100644 index 93d66233ecc..00000000000 --- a/google/test-fixtures/cloudfunctions/bucket_trigger.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Background Cloud Function to be triggered by Cloud Storage. - * - * @param {object} event The Cloud Functions event. - * @param {function} callback The callback function. - */ -exports.helloGCS = function (event, callback) { - const file = event.data; - - if (file.resourceState === 'not_exists') { - console.log(`File ${file.name} deleted.`); - } else if (file.metageneration === '1') { - // metageneration attribute is updated on metadata changes. - // on create value is 1 - console.log(`File ${file.name} uploaded.`); - } else { - console.log(`File ${file.name} metadata updated.`); - } - - callback(); -}; \ No newline at end of file diff --git a/google/test-fixtures/cloudfunctions/firestore_trigger.js b/google/test-fixtures/cloudfunctions/firestore_trigger.js deleted file mode 100644 index f921b2fedbf..00000000000 --- a/google/test-fixtures/cloudfunctions/firestore_trigger.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Background Cloud Function to be triggered by Firestore. - * - * @param {object} event The Cloud Functions event. - * @param {function} callback The callback function. - */ -exports.helloFirestore = function (event, callback) { - const messageId = event.params.messageId; - - console.log(`Received message ${messageId}`); - - callback(); -}; diff --git a/google/test-fixtures/cloudfunctions/http_trigger.js b/google/test-fixtures/cloudfunctions/http_trigger.js deleted file mode 100644 index 1b486f0986c..00000000000 --- a/google/test-fixtures/cloudfunctions/http_trigger.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * HTTP Cloud Function. - * - * @param {Object} req Cloud Function request context. - * @param {Object} res Cloud Function response context. - */ -exports.helloGET = function helloGET (req, res) { - res.send("Hello ${req.body.name || 'World'}!"); -}; diff --git a/google/test-fixtures/cloudfunctions/http_trigger_update.js b/google/test-fixtures/cloudfunctions/http_trigger_update.js deleted file mode 100644 index 3506ab48bf2..00000000000 --- a/google/test-fixtures/cloudfunctions/http_trigger_update.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * HTTP Cloud Function. - * - * @param {Object} req Cloud Function request context. - * @param {Object} res Cloud Function response context. - */ -exports.helloGET = function helloGET (req, res) { - res.send("Goodbye ${req.body.name || 'World'}!"); -}; diff --git a/google/test-fixtures/cloudfunctions/pubsub_trigger.js b/google/test-fixtures/cloudfunctions/pubsub_trigger.js deleted file mode 100644 index 4a49705a457..00000000000 --- a/google/test-fixtures/cloudfunctions/pubsub_trigger.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Background Cloud Function to be triggered by Pub/Sub. - * - * @param {object} event The Cloud Functions event. - * @param {function} callback The callback function. - */ -exports.helloPubSub = function (event, callback) { - const pubsubMessage = event.data; - const name = pubsubMessage.data ? Buffer.from(pubsubMessage.data, 'base64').toString() : 'World'; - - console.log(`Hello, ${name}!`); - - callback(); -}; \ No newline at end of file diff --git a/google/test-fixtures/cloudfunctions/secret_environment_variables.js b/google/test-fixtures/cloudfunctions/secret_environment_variables.js deleted file mode 100644 index 60c4fe52fe6..00000000000 --- a/google/test-fixtures/cloudfunctions/secret_environment_variables.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * HTTP Cloud Function for testing environment variable Secrets. - */ -exports.echoSecret = (req, res) => { - let message = req.query.message || req.body.message || "Secret: " + process.env.MY_SECRET; - res.status(200).send(message); -}; \ No newline at end of file diff --git a/google/test-fixtures/cloudfunctions/secret_volumes_mount.js b/google/test-fixtures/cloudfunctions/secret_volumes_mount.js deleted file mode 100644 index 3b100a8237b..00000000000 --- a/google/test-fixtures/cloudfunctions/secret_volumes_mount.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * HTTP Cloud Function for testing volume mount Secrets. - */ -const fs = require('fs') -exports.echoSecret = (req, res) => { - const path = '/etc/secrets/test-secret' - fs.access(path, fs.F_OK, (err) => { - if (err) { - console.error(err) - res.status(200).send(err) - return - } - fs.readFile(path, 'utf8', function (err, data) { - res.status(200).send("Secret: " + data) - - }); - }) -}; \ No newline at end of file diff --git a/google/test-fixtures/cloudfunctions2/function-source-eventarc-gcs.zip b/google/test-fixtures/cloudfunctions2/function-source-eventarc-gcs.zip deleted file mode 100644 index 5c731f5f5a9..00000000000 Binary files a/google/test-fixtures/cloudfunctions2/function-source-eventarc-gcs.zip and /dev/null differ diff --git a/google/test-fixtures/cloudfunctions2/function-source-pubsub.zip b/google/test-fixtures/cloudfunctions2/function-source-pubsub.zip deleted file mode 100644 index 0d6860aa6e3..00000000000 Binary files a/google/test-fixtures/cloudfunctions2/function-source-pubsub.zip and /dev/null differ diff --git a/google/test-fixtures/cloudfunctions2/index-js b/google/test-fixtures/cloudfunctions2/index-js deleted file mode 100644 index 70723fa354c..00000000000 --- a/google/test-fixtures/cloudfunctions2/index-js +++ /dev/null @@ -1,5 +0,0 @@ -const functions = require('@google-cloud/functions-framework'); - -functions.http('helloHttp', (req, res) => { - res.send(`Hello ${req.query.name || req.body.name || 'World'}!`); -}); \ No newline at end of file diff --git a/google/test-fixtures/deploymentmanager/service_account.yml.tmpl b/google/test-fixtures/deploymentmanager/service_account.yml.tmpl deleted file mode 100644 index dc8dbb2a40b..00000000000 --- a/google/test-fixtures/deploymentmanager/service_account.yml.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -resources: -- name: "%{account_id}" - type: iam.v1.serviceAccount - properties: - accountId: "%{account_id}" - displayName: "Test service account created by Terraform-created Deployment" diff --git a/google/test-fixtures/dlp/words.txt b/google/test-fixtures/dlp/words.txt deleted file mode 100644 index 3bffd2820b0..00000000000 --- a/google/test-fixtures/dlp/words.txt +++ /dev/null @@ -1,3 +0,0 @@ -word -word2 -custom \ No newline at end of file diff --git a/google/test-fixtures/fake_account.json b/google/test-fixtures/fake_account.json index f3362d6d2ae..52214ea66b1 100644 --- a/google/test-fixtures/fake_account.json +++ b/google/test-fixtures/fake_account.json @@ -4,4 +4,4 @@ "client_email": "foo@bar.com", "client_id": "id@foo.com", "type": "service_account" -} +} \ No newline at end of file diff --git a/google/test-fixtures/fake_client.json b/google/test-fixtures/fake_client.json deleted file mode 100644 index d88fe4cd7e0..00000000000 --- a/google/test-fixtures/fake_client.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "web": { - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "client_secret": "foo", - "token_uri": "https://accounts.google.com/o/oauth2/token", - "client_email": "foo@developer.gserviceaccount.com", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/foo@developer.gserviceaccount.com", - "client_id": "foo.apps.googleusercontent.com", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs" - } -} diff --git a/google/test-fixtures/header-logo.png b/google/test-fixtures/header-logo.png deleted file mode 100644 index 7d65c7a1554..00000000000 Binary files a/google/test-fixtures/header-logo.png and /dev/null differ diff --git a/google/test-fixtures/rsa_cert.pem b/google/test-fixtures/rsa_cert.pem deleted file mode 100644 index d8a834633c9..00000000000 --- a/google/test-fixtures/rsa_cert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICoDCCAYgCCQDzZ6R7RYs0sTANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZ1 -bnVzZWQwIBcNMTgwMTIwMTA0OTIzWhgPNDc1NTEyMTgxMDQ5MjNaMBExDzANBgNV -BAMMBnVudXNlZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMXX/5jI -tvxpst1mFVKVXfyu5S5AOQF+i/ny6Ef+h8py8y42XfsE2AAPSTE3JCIgWemw7NQ/ -xnTQ3f6b7/6+ZsdM4/hoiedwYV8X3LVPB9NRnKe82OHUhzo1psVMJVvHtE3GsD/V -i40ki/L4Xs64E2GJqQfrkgeNfIyCeKev64fR5aMazqOw1cNrVe34mY3L1hgXpn7e -SnO0oqnV86pTh+jTT8EKgo9AI7/QuJbPWpJhnj1/Fm8i3DdCdpQqloX9Fc4f6whA -XlZ2tkma0PsBraxMua5GPglJ7m3RabQIoyAW+4hEYAcu7U0wIhCK+C8WTNgEYZaK -zvp8vK6vOgBIjE0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAvVXus7dLikEAM6+I -6xeN7aHEMJRR0h2rigLiYjfl8R9zG/zxUPUunWPAYaKvWOFviXcX/KqpjDqIIeWx -Gm0yNfyalHq476nRCf/0t9AH5X4Qy0KJSW5KfhQLG9X2z/UiJxwHKCwaWZtEEzPu -mGqvwhNXUOL/GuAZCJWPdWrUGM4kHHz3kw5v3UPNS2xA7yMtN9N1b8/pkTQ77XNk -DA4wngA5zc7Ae72SJDrY8XXqLfL4Nagkrn6AOhGK3/Ewvca6hkThMcHI0WF2AqFo -mo3iGUJzR5lOUx+4RiEBC5NNEZsE9GMNEiu8kYvCAS0FMKYmxFPGx1U/kiOeeuIw -W3sOEA== ------END CERTIFICATE----- diff --git a/google/test-fixtures/rsa_csr.pem b/google/test-fixtures/rsa_csr.pem deleted file mode 100644 index acb70eb670e..00000000000 --- a/google/test-fixtures/rsa_csr.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIDETCCAfkCAQAwVDELMAkGA1UEBhMCVVMxDzANBgNVBAoMBkdvb2dsZTETMBEG -A1UECwwKRW50ZXJwcmlzZTEfMB0GA1UEAwwWc2VydmVyLmVzb2RlbW9hcHAyLmNv -bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMZThbWkUvD8wxzP/v/t -918Z0fhDYgSrow75G1kIbUf5Z3qG+l0AyLadIo3SqN3ENQYf2+O1VP9Hk90tyvCS -iGqjXJLCLXdrwLLqHoqFDxwm3bQ0/AlOIpmilS++BdHUew0HfqZq9lJOFPAF3EtL -LPaE0eRbA2HguHe4q/7jIIr999vYuafCtetrzIBI8ke9+S2VvPPw+ni2KZvmTb1+ -DnIqq7QX/t92Y9RW1UgeXqvc/LbYwnIfSyCpea1IvHILup+eQ/R2aeIgzFrDbuS4 -ULrxdJrMu4UXXPJMbw7xSOAdhJoX+uky08bR3pbUbt6wNwwjuDLNLBIdlYZK6seL -QRsCAwEAAaB4MHYGCSqGSIb3DQEJDjFpMGcwDgYDVR0PAQH/BAQDAgeAMBMGA1Ud -JQQMMAoGCCsGAQUFBwMBMB0GA1UdDgQWBBQ/ZBWqbeL7spn5xkS9awVgZ5L1ITAh -BgNVHREEGjAYghZzZXJ2ZXIuZXNvZGVtb2FwcDIuY29tMA0GCSqGSIb3DQEBBQUA -A4IBAQAJoFccsGUrdoPRuhjvhrtjnj2D8hEAA0bt+numzT5E26Cte7HHRg2Jn2f7 -5qxNunesf86FBjOtg/dr3tKIAPAQ7H6yojq/XFFrKkbDpYodigdxeD4pQ2NaZxPU -2FJZoGyoxoUMb7wozROTJDRI0hAmkVUtUgta3UHtDuVXLYTwpKCBHqFi6Nshv8jO -XTHsr7G/a0ky0nnbzYvhilyzZQS7k1F2pQIhzTFZtvwzM9JvpWyzS7I8W8QX5YqG -bqDgRvIy7MHu0sWjOPvSKtU5ivW+wawEytspDxdEapivIAzY7wvMH27ixm0sfCxN -tRlgsGSzkSXGk9c4MHDtmGFFfD0U ------END CERTIFICATE REQUEST----- diff --git a/google/test-fixtures/rsa_private_4096.pem b/google/test-fixtures/rsa_private_4096.pem deleted file mode 100644 index 14be2aca825..00000000000 --- a/google/test-fixtures/rsa_private_4096.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQC/rB4LVpPXqXap -Lqp1hzLsE6PM/tPBP3NQCIWFakvbnoZGoLzJBF2oyyLrxD//vrYhTK7+podsSBDx -ZGZB1VUYOXGQF+sD+JcHZ2C6OryOHQdYhXZ6/dN6tXdpTC9hSWujCGrTbtJf1TWF -u590YIy4qweIXTkSuA28S5HxcCR4n9hXYNXb6xGr5aD3LhHBRht1yF0W3LV3lJf+ -zRiqzCDI4b1WgJ1HttoXba6CFVHjhpGb7zeaC2oBngz5Gl7skZGxQZj+lHf3VOiL -SzwSfXkkaICGpfZbRSj8VlmvLfK6pF90dgQ0H4AO7JMxOtRopm/t65rSVMHPmiib -eNIXeC8jtJCgt0r+OERU46rjUiMHwPrRKB3r1sPvJMjnXrK9n+zcDIrNbp/oqeN1 -sJxkopPQYB480s2ENh9KUD1vAnwdBLYV6dKlJMCsq8aJWuyKcm42NtB0+5AdylZ/ -3HWbcZFMy8X5M1gz+WnsgvZUxslF9Y/LWJbGb0XVivp2QdWgs/uhxiQ1Eeg8u63k -TogUm0qVUjY2d5RgkadhI77XE9X1OqUl4w3Cve4UwA3w3+gHd/hZbC5FiBHQvmDY -D4u/H6Btt2X5Nv/QI1+yV9K4OsVXxnifqBXBv1k8aU0cK+epF8tSlEUnCZHtRi/O -L8TutckQOQr61yc+TPYm2N0spHupVwIDAQABAoICAQC/iO2VAvVGI3ASbDGmtG3s -f0vGRDey+wbuSTW0Np6LXoRr+5/reFNno2bIFxqlJBy4dfrBOgRF7lYQAvY0f0xD -otOa3GvbUgUKPwHn114o3VVD3kqhaRh1nPUw4hLOsyG+j2DA3BOZ9GNBulYDY5/7 -wd0LJa0syYPgT9wNWrT3XTRBTOEonGTSU+tgVkcjzj0OnCR5/h/Q2UpyMt2df9Kb -KwmbcXa5/T0/ADnMgCWOqiDDpG75nsJVz2zDWNjWqjje2uBaNl8TZ2PiHlJvX7c4 -7LzS0PG4Dwp/7oI8jjvqyusgY/abZ4b+YuZL4a/0y606IaBa4puyKyi9BCVdkpn2 -5YCQ/iOqzUfsllfqgdbpgwtDyjpwQ7wkghQAlJn6sb0YnU0g5wBP4UkAYyLahB+Z -AYO9rTs9qvx6jlqDVAcCbIHLXnf41aKGYOPWvxDkBe30LCMWbaLpmpsD7ImUlqX2 -VsRuk8RuQpiLmsBXoD9zBPdkZCzvp6HF9B7weLxEaj1ciArEHAHyTJFNqrOwJz1Y -ndSitxIioes64kAVfe4YcQCmGLVTg4YOF+6Nf1COnHEVkHQb8dXiUSDisq+6iW9n -fIqLp7cqp9aNjjKMCmMngNPs5856c91Er7Q+FtuVII3uwWaCZ8sxhXZg2M8nahUQ -JfiU6MYiXK/hkSlbA3RssQKCAQEA82bP5KK9ZjHWUVstnVbnCV2IXBI+jW3PF/B6 -x334atmmtKl0cFuP3jHjYDW7ZX2YiQALxG2ARRAgm5QpimKwIQtiHVNCfO0lhRBZ -iBumcIsxHyQ+YlDZ6T3dRQIaFpgFVgQhSzmxRi9XFnT597qw0WkyWEqI+9cL05rx -NUrzmR1aCq4B8XykT+kU6hcZLw2pX7XIY5O4NfNneU55/WQnw7HSGSBh/07YjfZl -q82SKY+bsC2+B3XJEGTL70RxW0KIuxvmZF3cbmTx4o7jR4f+/E0F7NSf+iOq8cLl -blmrX1qwmGS7NTzYQv+Vv1rb0yoqt2ocysndRUuvpKErKGLzbQKCAQEAyZfeGlZ5 -L0CC+NWg606Ayuv6GmmHqGbMzaqPsOjURBAcbwHCnR2s9ziC433ZwNPGxbBQHvwV -Femja7MXjU7mC+u3musitrrYs/NZLVeFHAO83pqy4tsmplN0oaPU6cJim+ftZ8hx -NQ8baUjURkrut9S47ne1bmx1tmJy+57lloK4glKilayby9x5aPxxoIzScr44orFy -a/UIjaI4TdIqaI2ma2r5FyWSt6bliHeQHDoHVbB4uAIn4MH33RDMwAUsHyBNHtjT -MiIIH2RMi8uQdDC46yBZnub2ysY9u7X87Cjdx0m08SqqE1E4DyiY5XbuGCMulXr5 -NjCVDI30CN6RUwKCAQEAojUDGLBnniJaXG9yD6fpYjFl/U3fR+tFFwQZHrdRhQu1 -cDJ5uaMbVo1SpTxJvZIcxDg2n1oGIIBl6qiromCwVeU7JqXk6lI0LeA+ellK6zen -rcQ+mtCc2DZ1Llb/Qc1fyPoJohM5k7dax0l/iFtvGK+NcI+DiKnAZO2eD9D6VDDe -X72k5+UTr3l6iaKJEvV8yZ7gg5PfMH0cmRf2bip/4YewpzQQes91u+3Xxc3CuVXO -AHQLbvdM3lL+IV8wWAwYCPHH8V0n2J4HIN/ukS4NfOBrsW/liRKaCnHC6m5xqaNL -itOeexUoXkXr6tFHLAuu2fqqY25xuot86y7JDyoaZQKCAQAxXGU+z7OmlUY8hZp8 -Y2F3zmYT94kG+/zj0wKSD8CB1ewQZj7v16dVdVnfOB6Mb455M1266ICFOAsSwOxg -ZlQ/0PzJCxAZ7BBJp6lLR+XI4UVqwDhTAdQp379sIMBuaHFauWRRCCxoEIXmtrV7 -bLec/ZI2mcsr+ZStDtgWsmaG/wUMrA0xVu1i8l4sDbwI0tJo1BjsBUT+GCZ6/6CH -tZE6voxkOvI477NIEq6bRqNbtf27xpUYgTagev4k/AsWbW3LRU584hx8ZwbUIOv5 -QuPg/1kYAXjQRr9hET9maf4/GRaMyIhskMTKLBXs6ETf0soj0OGEKnNBCI5GX6/E -SDMPAoIBAQC767WNJ31WeaO/7ut0SI5vabFff7f9DkdVlVkeJxooFNrDLgb66aaC -4JTfeqSCv6w/7ABcQyyaHxSZhZjMiuKHroDVDznq0xPjADqxXnbd05ih5aPnuedm -Hm+oQN0o/ozs7FwMRbvzx45kHHMZvShISR1IHGCuw915OkwA4JHzY5CljRK51Lhq -VR3LpLxD3pmSirARGGGVJ0IdYcwlmTo+4ACeX6wOH6FH8gtccTw2HNTSskCq0cQp -zi0EpoUWQNjFsuZ2W5dwgWr5AoEnsRkKMEucaYiP+kTGC6R4sZaSTDZpg5ikxZFX -4xmS3YG5FDvzS9GmJK0YvstxZHMb28ii ------END PRIVATE KEY----- diff --git a/google/test-fixtures/rsa_public.pem b/google/test-fixtures/rsa_public.pem deleted file mode 100644 index 2b2acadf676..00000000000 --- a/google/test-fixtures/rsa_public.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAv6weC1aT16l2qS6qdYcy -7BOjzP7TwT9zUAiFhWpL256GRqC8yQRdqMsi68Q//762IUyu/qaHbEgQ8WRmQdVV -GDlxkBfrA/iXB2dgujq8jh0HWIV2ev3TerV3aUwvYUlrowhq027SX9U1hbufdGCM -uKsHiF05ErgNvEuR8XAkeJ/YV2DV2+sRq+Wg9y4RwUYbdchdFty1d5SX/s0Yqswg -yOG9VoCdR7baF22ughVR44aRm+83mgtqAZ4M+Rpe7JGRsUGY/pR391Toi0s8En15 -JGiAhqX2W0Uo/FZZry3yuqRfdHYENB+ADuyTMTrUaKZv7eua0lTBz5oom3jSF3gv -I7SQoLdK/jhEVOOq41IjB8D60Sgd69bD7yTI516yvZ/s3AyKzW6f6KnjdbCcZKKT -0GAePNLNhDYfSlA9bwJ8HQS2FenSpSTArKvGiVrsinJuNjbQdPuQHcpWf9x1m3GR -TMvF+TNYM/lp7IL2VMbJRfWPy1iWxm9F1Yr6dkHVoLP7ocYkNRHoPLut5E6IFJtK -lVI2NneUYJGnYSO+1xPV9TqlJeMNwr3uFMAN8N/oB3f4WWwuRYgR0L5g2A+Lvx+g -bbdl+Tb/0CNfslfSuDrFV8Z4n6gVwb9ZPGlNHCvnqRfLUpRFJwmR7UYvzi/E7rXJ -EDkK+tcnPkz2JtjdLKR7qVcCAwEAAQ== ------END PUBLIC KEY----- diff --git a/google/test-fixtures/serviceaccount/public_key.pem b/google/test-fixtures/serviceaccount/public_key.pem deleted file mode 100644 index 033abb61632..00000000000 --- a/google/test-fixtures/serviceaccount/public_key.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICnjCCAYYCCQD6STTBmcOGNTANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZ1 -bnVzZWQwHhcNMjAwODEwMTExNzU0WhcNMzAwODA4MTExNzU0WjARMQ8wDQYDVQQD -DAZ1bnVzZWQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAGCUQbs0l -yyalBW4rBgWvU2awMXiVyQMOhWMQVMd99CgtY4Rzktj7qWnPiKe/daegyz40FXuq -2Is8RThit4hx0RrdRFm8XXYpJjhHbIpCD/e5ukVMLNDIBqiMuFQI9naKcppuzOtL -htj3zOQ54qXwe183lrg60RHoVR95Z1QqnCGkZcyECGJMuQBEaYyTnzf/nFba05uP -LcZS1RHtdu5xfdDCrS9vDYA7R/3tvQ2erRvETSUFpMyIOxSMgZEBKhDhVfYqVh5T -gSo3fJ5oXHozdqno2nf+MkE71moP4LbwqUGrSWK19kLcOGnGxWzLwcJWDTDlnU1S -MC1y1T7GG+4dAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKZXsIoQ7CZhtb7GL7m6 -tVO/Q4WuL2D3sL0EYHpHWMUDFZ9aXeiNEaTJLYeaAkVQ80y+i1D2xaK42S/m94sd -mq4UKy0sRN25brVXFGjhBNwk2iJlWPj9/ibttMLKMT2nxPWS+YQOCZXg5B60wUFD -mmKkdsbZmrLe2VX2lHGvWuZF2ZFpx9wKcrLmQBhQ/1tZV7k8bf/JiWlGkQqDzwBZ -m+xUNAUpu32QQwkNGUNte562KK9nzsbVD0qDBFcmh3sEirOgiU4ezEWdmbFhtcfH -Q1lTZZ1oD38RmMNPnJUHY+b7W57TrsYO5inFjBwjYJ4plTUG12RSZ8nPz6whZTK6 -Gys= ------END CERTIFICATE----- diff --git a/google/test-fixtures/ssh_rsa.pub b/google/test-fixtures/ssh_rsa.pub deleted file mode 100644 index c3f21e84492..00000000000 --- a/google/test-fixtures/ssh_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EXYZTDAQABAAABAQDK/Mq0qy+O5AaNc1Ag5SGb+toqGiMu9cnLA5irVDsuAIs+HACy7z+T8QnN6z/q3TtgWs5jZG4JPGQ4xj+ai3esM+hRIwGWmvxkNfJWAVzK61yBTUHh6p1PrS12h3tLmupDTBVtOzzcbszo9eD+3kXtKsNoxiRPGFhzGa20fBlVRwJkb22LAlXbrtdKWiyozjRA5DBiXmLbUQmF9PkyYwAHUvp6g6I0lgJioxvVLLdp6h6uThAtIudsbKXG5s9Vr2hJ0mlcnVa/la0bUqBEcxfECs6b2CXsWRBNVEjodSJ4cI4rtwKxuZgRXWflnQtDN5PJyPqhtynSTXYnRohXekUr diff --git a/google/test-fixtures/ssl_cert/test.crt b/google/test-fixtures/ssl_cert/test.crt deleted file mode 100644 index 122d22d85ca..00000000000 --- a/google/test-fixtures/ssl_cert/test.crt +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDgjCCAmoCCQCPrrFCwXharzANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMC -VVMxETAPBgNVBAgMCE5ldy1Zb3JrMQwwCgYDVQQHDANOWUMxFTATBgNVBAoMDE9y -Z2FuaXphdGlvbjEQMA4GA1UECwwHU2VjdGlvbjEQMA4GA1UEAwwHTXkgTmFtZTEX -MBUGCSqGSIb3DQEJARYIbWVAbWUubWUwHhcNMTUxMTIwMTM0MTIwWhcNMTYxMTE5 -MTM0MTIwWjCBgjELMAkGA1UEBhMCVVMxETAPBgNVBAgMCE5ldy1Zb3JrMQwwCgYD -VQQHDANOWUMxFTATBgNVBAoMDE9yZ2FuaXphdGlvbjEQMA4GA1UECwwHU2VjdGlv -bjEQMA4GA1UEAwwHTXkgTmFtZTEXMBUGCSqGSIb3DQEJARYIbWVAbWUubWUwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDbTuIV7EySLAijNAnsXG7HO/m4 -pu1Yy2sWWcqIifaSq0pL3JUGmWRKFRTb4msFIuKrkvsMLxWy6zIOnx0okRb7sTKb -XLBiN7zjSLCD6k31zlllO0GHkPu923VeGZ52xlIWxo22R2yoRuddD0YkQPctV7q9 -H7sKJq2141Ut9reMT2LKVRPlzf8wTcv+F+cAc3/i9Tib90GqclGrwk6XE59RBgzT -m9V7b/V+uusDtj6T3/ne5MHnq4g6lUz4mE7FneDVealjx7fHXtWSmR7dfbJilJj1 -foR/wPBeopdR5wAZS26bHjFIBMqAc7AgxbXdMorEDIY4i2OFjPTu22YYtmFZAgMB -AAEwDQYJKoZIhvcNAQELBQADggEBAHmgedgYDSIPiyaZnCWG56jFqYtHYS5xMOFS -T4FBEPsqgjbSYgjiugeQ37+nsbg/NQf4Z/Ca9CS20f7et8pjZWYqbqdGbifHSUAP -MsR3MK/8EsNVskioufvgExNrqHbcJD8aKrBHAyA6NbjaTnnBPrwdfcXxnWdpPNOh -yG6xSdi807t2e7dX59Nr6Fg6DHd9XPEM7VL/k5RBQyBf1ZgrO9cwA2jl8UtWKpaa -fO24S7Acwggi9TjJnyHOhWh21DEUEQG+czXAd5/LSjynTcI7xmuyfEgqJPIrskPv -OqM8II/iNr9Zglvp6hlmzIWnhgwLZiEljYGuMRNhr21jlHsCCYY= ------END CERTIFICATE----- diff --git a/google/test-fixtures/ssl_cert/test.csr b/google/test-fixtures/ssl_cert/test.csr deleted file mode 100644 index dee9945edff..00000000000 --- a/google/test-fixtures/ssl_cert/test.csr +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICyDCCAbACAQAwgYIxCzAJBgNVBAYTAlVTMREwDwYDVQQIDAhOZXctWW9yazEM -MAoGA1UEBwwDTllDMRUwEwYDVQQKDAxPcmdhbml6YXRpb24xEDAOBgNVBAsMB1Nl -Y3Rpb24xEDAOBgNVBAMMB015IE5hbWUxFzAVBgkqhkiG9w0BCQEWCG1lQG1lLm1l -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA207iFexMkiwIozQJ7Fxu -xzv5uKbtWMtrFlnKiIn2kqtKS9yVBplkShUU2+JrBSLiq5L7DC8VsusyDp8dKJEW -+7Eym1ywYje840iwg+pN9c5ZZTtBh5D7vdt1XhmedsZSFsaNtkdsqEbnXQ9GJED3 -LVe6vR+7CiatteNVLfa3jE9iylUT5c3/ME3L/hfnAHN/4vU4m/dBqnJRq8JOlxOf -UQYM05vVe2/1frrrA7Y+k9/53uTB56uIOpVM+JhOxZ3g1XmpY8e3x17Vkpke3X2y -YpSY9X6Ef8DwXqKXUecAGUtumx4xSATKgHOwIMW13TKKxAyGOItjhYz07ttmGLZh -WQIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBAGtNMtOtE7gUP5DbkZNxPsoGazkM -c3//gjH3MsTFzQ39r1uNq3fnbBBoYeQnsI05Bf7kSEVeT6fzdl5aBhOWxFF6uyTI -TZzcH9kvZ2IwFDbsa6vqrIJ6jIkpCIfPR8wN5LlBca9oZwJnt4ejF3RB5YBfnmeo -t5JXTbxGRvPBVRZCfJgcxcn731m1Rc8c9wud2IaNWiLob2J/92BJhSt/aiYps/TJ -ww5dRi6zhpxhR+RjlstG3C6oeYeQlSgzeBjhRcxtPHQWfcVfRLCtubqvuUQPcpw2 -YqMujh4vyKo+JEtqI8gqp4Bu0HVI1vr1vhblntFrQb0kueqV94HarE0uH+c= ------END CERTIFICATE REQUEST----- diff --git a/google/test-fixtures/ssl_cert/test.key b/google/test-fixtures/ssl_cert/test.key deleted file mode 100644 index 92dd451371a..00000000000 --- a/google/test-fixtures/ssl_cert/test.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA207iFexMkiwIozQJ7Fxuxzv5uKbtWMtrFlnKiIn2kqtKS9yV -BplkShUU2+JrBSLiq5L7DC8VsusyDp8dKJEW+7Eym1ywYje840iwg+pN9c5ZZTtB -h5D7vdt1XhmedsZSFsaNtkdsqEbnXQ9GJED3LVe6vR+7CiatteNVLfa3jE9iylUT -5c3/ME3L/hfnAHN/4vU4m/dBqnJRq8JOlxOfUQYM05vVe2/1frrrA7Y+k9/53uTB -56uIOpVM+JhOxZ3g1XmpY8e3x17Vkpke3X2yYpSY9X6Ef8DwXqKXUecAGUtumx4x -SATKgHOwIMW13TKKxAyGOItjhYz07ttmGLZhWQIDAQABAoIBABEjzyOrfiiGbH5k -2MmyR64mj9PQqAgijdIHXn7hWXYJERtwt+z2HBJ2J1UwEvEp0tFaAWjoXSfInfbq -lJrRDBzLsorV6asjdA3HZpRIwaMOZ4oz4WE5AZPLDRc3pVzfDxdcmUK/vkxAjmCF -ixPWR/sxOhUB39phP35RsByRhbLfdGQkSspmD41imASqdqG96wsuc9Rk1Qjx9szr -kUxZkQGKUkRz4yQCwTR4+w2I21/cT5kxwM/KZG5f62tqB9urtFuTONrm7Z7xJv1T -BkHxQJxtsGhG8Dp8RB3t5PLou39xaBrjS5lpzJYtzrja25XGNEuONiQlWEDmk7li -acJWPQECgYEA98hjLlSO2sudUI36kJWc9CBqFznnUD2hIWRBM/Xc7mBhFGWxoxGm -f2xri91XbfH3oICIIBs52AdCyfjYbpF0clq8pSL+gHzRQTLcLUKVz3BxnxJAxyIG -QYPxmtMLVSzB5eZh+bPvcCyzd2ALDE1vFClQI/BcK/2dsJcXP2gSqdECgYEA4pTA -3okbdWOutnOwakyfVAbXjMx81D9ii2ZGHbuPY4PSD/tAe8onkEzHJgvinjddbi9p -oGwFhPqgfdWX7YNz5qsj9HP6Ehy7dw/EwvmX49yHsere85LiPMn/T9KkK0Pbn+HY -+0Q+ov/2wV3J7zPo8fffyQYizUKexGUN3XspGQkCgYEArFsMeobBE/q8g/MuzvHz -SnFduqhBebRU59hH7q/gLUSHYtvWM7ssWMh/Crw9e7HrcQ7XIZYup1FtqPZa/pZZ -LM5nGGt+IrwwBq0tMKJ3eOMbde4Jdzr4pQv1vJ9+65GFkritgDckn5/IeoopRTZ7 -xMd0AnvIcaUp0lNXDXkEOnECgYAk2C2YwlDdwOzrLFrWnkkWX9pzQdlWpkv/AQ2L -zjEd7JSfFqtAtfnDBEkqDaq3MaeWwEz70jT/j8XDUJVZARQ6wT+ig615foSZcs37 -Kp0hZ34FV30TvKHfYrWKpGUfx/QRxqcDDPDmjprwjLDGnflWR4lzZfUIzbmFlC0y -A9IGCQKBgH3ieP6nYCJexppvdxoycFkp3bSPr26MOCvACNsa+wJxBo59Zxs0YAmJ -9f6OOdUExueRY5iZCy0KPSgjYj96RuR0gV3cKc/WdOot4Ypgc/TK+r/UPDM2VAHk -yJuxkyXdOrstesxZIxpourS3kONtQUqMFmdqQeBngZl4v7yBtiRW ------END RSA PRIVATE KEY----- diff --git a/google/test-fixtures/test_api_descriptor.pb b/google/test-fixtures/test_api_descriptor.pb deleted file mode 100644 index 4b98d9f1435..00000000000 Binary files a/google/test-fixtures/test_api_descriptor.pb and /dev/null differ diff --git a/google/test-fixtures/workflow.yaml b/google/test-fixtures/workflow.yaml deleted file mode 100644 index 07d6c6ff1f2..00000000000 --- a/google/test-fixtures/workflow.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# This is a sample workflow that simply logs the incoming Pub/Sub event -# Note that $$ is needed for Terraform - -main: - params: [event] - steps: - - log_event: - call: sys.log - args: - text: $${event} - severity: INFO - - decode_pubsub_message: - assign: - - base64: $${base64.decode(event.data.data)} - - message: $${text.decode(base64)} - - return_pubsub_message: - return: $${message} diff --git a/google/test_utils.go b/google/test_utils.go deleted file mode 100644 index 575351074e3..00000000000 --- a/google/test_utils.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-go/tfprotov5" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" -) - -// Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceState is still working, -// but all new code should use CheckDataSourceStateMatchesResourceState in the acctest package instead. -func CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName string) func(*terraform.State) error { - return acctest.CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName) -} - -// Deprecated: For backward compatibility CheckDataSourceStateMatchesResourceStateWithIgnores is still working, -// but all new code should use CheckDataSourceStateMatchesResourceStateWithIgnores in the acctest package instead. -func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) func(*terraform.State) error { - return acctest.CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName, ignoreFields) -} - -// General test utils - -func RandString(t *testing.T, length int) string { - return acctest.RandString(t, length) -} - -func RandInt(t *testing.T) int { - return acctest.RandInt(t) -} - -// ProtoV5ProviderFactories returns a muxed ProviderServer that uses the provider code from this repo (SDK and plugin-framework). -// Used to set ProtoV5ProviderFactories in a resource.TestStep within an acceptance test. -func ProtoV5ProviderFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { - return acctest.ProtoV5ProviderFactories(t) -} - -// ProtoV5ProviderBetaFactories returns the same as ProtoV5ProviderFactories only the provider is mapped with -// "google-beta" to ensure that registry examples use `google-beta` if the example is versioned as beta; -// normal beta tests should continue to use ProtoV5ProviderFactories -func ProtoV5ProviderBetaFactories(t *testing.T) map[string]func() (tfprotov5.ProviderServer, error) { - return acctest.ProtoV5ProviderBetaFactories(t) -} - -func serviceAccountCanonicalEmail(account string) string { - return envvar.ServiceAccountCanonicalEmail(account) -} - -func getResourceAttributes(n string, s *terraform.State) (map[string]string, error) { - return tpgresource.GetResourceAttributes(n, s) -} - -// Deprecated: For backward compatibility testBucketName is still working, -// but all new code should use TestBucketName in the acctest package instead. -func testBucketName(t *testing.T) string { - return acctest.TestBucketName(t) -} - -// Deprecated: For backward compatibility createZIPArchiveForCloudFunctionSource is still working, -// but all new code should use CreateZIPArchiveForCloudFunctionSource in the acctest package instead. -func createZIPArchiveForCloudFunctionSource(t *testing.T, sourcePath string) string { - return acctest.CreateZIPArchiveForCloudFunctionSource(t, sourcePath) -} diff --git a/google/tpgresource/utils_test.go b/google/tpgresource/utils_test.go index 4a68a92882f..139c6b9f2b3 100644 --- a/google/tpgresource/utils_test.go +++ b/google/tpgresource/utils_test.go @@ -1,8 +1,9 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -package tpgresource +package tpgresource_test import ( + "fmt" "reflect" "strings" "testing" @@ -10,6 +11,8 @@ import ( "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" "google.golang.org/api/googleapi" @@ -43,7 +46,7 @@ func TestConvertStringArr(t *testing.T) { input[2] = "aaa" expected := []string{"aaa", "bbb", "ccc"} - actual := ConvertStringArr(input) + actual := tpgresource.ConvertStringArr(input) if reflect.DeepEqual(expected, actual) { t.Fatalf("(%s) did not match expected value: %s", actual, expected) @@ -57,7 +60,7 @@ func TestConvertAndMapStringArr(t *testing.T) { input[2] = "aaa" expected := []string{"AAA", "BBB", "CCC"} - actual := ConvertAndMapStringArr(input, strings.ToUpper) + actual := tpgresource.ConvertAndMapStringArr(input, strings.ToUpper) if reflect.DeepEqual(expected, actual) { t.Fatalf("(%s) did not match expected value: %s", actual, expected) @@ -71,7 +74,7 @@ func TestConvertStringMap(t *testing.T) { input["three"] = "3" expected := map[string]string{"one": "1", "two": "2", "three": "3"} - actual := ConvertStringMap(input) + actual := tpgresource.ConvertStringMap(input) if !reflect.DeepEqual(expected, actual) { t.Fatalf("%s did not match expected value: %s", actual, expected) @@ -116,7 +119,7 @@ func TestIpCidrRangeDiffSuppress(t *testing.T) { } for tn, tc := range cases { - if IpCidrRangeDiffSuppress("ip_cidr_range", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress { + if tpgresource.IpCidrRangeDiffSuppress("ip_cidr_range", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress { t.Fatalf("bad: %s, '%s' => '%s' expect %t", tn, tc.Old, tc.New, tc.ExpectDiffSuppress) } } @@ -159,7 +162,7 @@ func TestRfc3339TimeDiffSuppress(t *testing.T) { }, } for tn, tc := range cases { - if Rfc3339TimeDiffSuppress("time", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress { + if tpgresource.Rfc3339TimeDiffSuppress("time", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress { t.Errorf("bad: %s, '%s' => '%s' expect DiffSuppress to return %t", tn, tc.Old, tc.New, tc.ExpectDiffSuppress) } } @@ -203,10 +206,10 @@ func TestGetProject(t *testing.T) { // Create resource config // Here use a fictional schema that includes a project field - d := SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) + d := tpgresource.SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) // Act - project, err := GetProject(d, &config) + project, err := tpgresource.GetProject(d, &config) // Assert if err != nil { @@ -352,10 +355,10 @@ func TestGetLocation(t *testing.T) { // Here use a fictional schema as example because we need to have all of // location, region, and zone fields present in the schema for the test, // and no real resources would contain all of these - d := SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) + d := tpgresource.SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) // Act - location, err := GetLocation(d, &config) + location, err := tpgresource.GetLocation(d, &config) // Assert if err != nil { @@ -445,10 +448,10 @@ func TestGetZone(t *testing.T) { // Here use a fictional schema as example because we need to have all of // location, region, and zone fields present in the schema for the test, // and no real resources would contain all of these - d := SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) + d := tpgresource.SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) // Act - zone, err := GetZone(d, &config) + zone, err := tpgresource.GetZone(d, &config) // Assert if err != nil { @@ -570,10 +573,10 @@ func TestGetRegion(t *testing.T) { // Here use a fictional schema as example because we need to have all of // location, region, and zone fields present in the schema for the test, // and no real resources would contain all of these - d := SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) + d := tpgresource.SetupTestResourceDataFromConfigMap(t, fictionalSchema, tc.ResourceConfig) // Act - region, err := GetRegion(d, &config) + region, err := tpgresource.GetRegion(d, &config) // Assert if err != nil { @@ -592,7 +595,7 @@ func TestGetRegion(t *testing.T) { func TestGetRegionFromZone(t *testing.T) { expected := "us-central1" - actual := GetRegionFromZone("us-central1-f") + actual := tpgresource.GetRegionFromZone("us-central1-f") if expected != actual { t.Fatalf("Region (%s) did not match expected value: %s", actual, expected) } @@ -811,7 +814,7 @@ func TestDatasourceSchemaFromResourceSchema(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := DatasourceSchemaFromResourceSchema(tt.args.rs); !reflect.DeepEqual(got, tt.want) { + if got := tpgresource.DatasourceSchemaFromResourceSchema(tt.args.rs); !reflect.DeepEqual(got, tt.want) { t.Errorf("DatasourceSchemaFromResourceSchema() = %#v, want %#v", got, tt.want) } }) @@ -819,7 +822,7 @@ func TestDatasourceSchemaFromResourceSchema(t *testing.T) { } func TestEmptyOrDefaultStringSuppress(t *testing.T) { - testFunc := EmptyOrDefaultStringSuppress("default value") + testFunc := tpgresource.EmptyOrDefaultStringSuppress("default value") cases := map[string]struct { Old, New string @@ -880,7 +883,7 @@ func TestServiceAccountFQN(t *testing.T) { for tn, tc := range cases { config := &transport_tpg.Config{Project: tc.project} d := &schema.ResourceData{} - serviceAccountName, err := ServiceAccountFQN(tc.serviceAccount, d, config) + serviceAccountName, err := tpgresource.ServiceAccountFQN(tc.serviceAccount, d, config) if err != nil { t.Fatalf("unexpected error for service account FQN: %s", err) } @@ -894,19 +897,19 @@ func TestConflictError(t *testing.T) { confErr := &googleapi.Error{ Code: 409, } - if !IsConflictError(confErr) { + if !tpgresource.IsConflictError(confErr) { t.Error("did not find that a 409 was a conflict error.") } - if !IsConflictError(errwrap.Wrapf("wrap", confErr)) { + if !tpgresource.IsConflictError(errwrap.Wrapf("wrap", confErr)) { t.Error("did not find that a wrapped 409 was a conflict error.") } confErr = &googleapi.Error{ Code: 412, } - if !IsConflictError(confErr) { + if !tpgresource.IsConflictError(confErr) { t.Error("did not find that a 412 was a conflict error.") } - if !IsConflictError(errwrap.Wrapf("wrap", confErr)) { + if !tpgresource.IsConflictError(errwrap.Wrapf("wrap", confErr)) { t.Error("did not find that a wrapped 412 was a conflict error.") } // skipping negative tests as other cases may be added later. @@ -914,15 +917,15 @@ func TestConflictError(t *testing.T) { func TestIsNotFoundGrpcErrort(t *testing.T) { error_status := status.New(codes.FailedPrecondition, "FailedPrecondition error") - if IsNotFoundGrpcError(error_status.Err()) { + if tpgresource.IsNotFoundGrpcError(error_status.Err()) { t.Error("found FailedPrecondition as a NotFound error") } error_status = status.New(codes.OK, "OK") - if IsNotFoundGrpcError(error_status.Err()) { + if tpgresource.IsNotFoundGrpcError(error_status.Err()) { t.Error("found OK as a NotFound error") } error_status = status.New(codes.NotFound, "NotFound error") - if !IsNotFoundGrpcError(error_status.Err()) { + if !tpgresource.IsNotFoundGrpcError(error_status.Err()) { t.Error("expect a NotFound error") } } @@ -930,7 +933,7 @@ func TestIsNotFoundGrpcErrort(t *testing.T) { func TestSnakeToPascalCase(t *testing.T) { input := "boot_disk" expected := "BootDisk" - actual := SnakeToPascalCase(input) + actual := tpgresource.SnakeToPascalCase(input) if actual != expected { t.Fatalf("(%s) did not match expected value: %s", actual, expected) @@ -953,7 +956,7 @@ func TestCheckGoogleIamPolicy(t *testing.T) { } for _, tc := range cases { - err := CheckGoogleIamPolicy(tc.json) + err := tpgresource.CheckGoogleIamPolicy(tc.json) if tc.valid && err != nil { t.Errorf("The JSON is marked as valid but triggered an error: %s", tc.json) } else if !tc.valid && err == nil { @@ -1063,7 +1066,7 @@ func TestReplaceVars(t *testing.T) { for tn, tc := range cases { t.Run(tn, func(t *testing.T) { - d := &ResourceDataMock{ + d := &tpgresource.ResourceDataMock{ FieldsInSchema: tc.SchemaValues, } @@ -1072,7 +1075,7 @@ func TestReplaceVars(t *testing.T) { config = &transport_tpg.Config{} } - v, err := ReplaceVars(d, config, tc.Template) + v, err := tpgresource.ReplaceVars(d, config, tc.Template) if err != nil { if !tc.ExpectedError { @@ -1091,3 +1094,44 @@ func TestReplaceVars(t *testing.T) { }) } } + +func TestCheckGCSName(t *testing.T) { + valid63 := acctest.RandString(t, 63) + cases := map[string]bool{ + // Valid + "foobar": true, + "foobar1": true, + "12345": true, + "foo_bar_baz": true, + "foo-bar-baz": true, + "foo-bar_baz1": true, + "foo--bar": true, + "foo__bar": true, + "foo-goog": true, + "foo.goog": true, + valid63: true, + fmt.Sprintf("%s.%s.%s", valid63, valid63, valid63): true, + + // Invalid + "goog-foobar": false, + "foobar-google": false, + "-foobar": false, + "foobar-": false, + "_foobar": false, + "foobar_": false, + "fo": false, + "foo$bar": false, + "foo..bar": false, + acctest.RandString(t, 64): false, + fmt.Sprintf("%s.%s.%s.%s", valid63, valid63, valid63, valid63): false, + } + + for bucketName, valid := range cases { + err := tpgresource.CheckGCSName(bucketName) + if valid && err != nil { + t.Errorf("The bucket name %s was expected to pass validation and did not pass.", bucketName) + } else if !valid && err == nil { + t.Errorf("The bucket name %s was NOT expected to pass validation and passed.", bucketName) + } + } +} diff --git a/google/transport_test_utils.go b/google/transport_test_utils.go deleted file mode 100644 index 7e2a23e49e6..00000000000 --- a/google/transport_test_utils.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// This function isn't a test of transport.go; instead, it is used as an alternative -// to ReplaceVars inside tests. -// -// Deprecated: For backward compatibility replaceVarsForTest is still working, -// but all new code should use ReplaceVarsForTest in the tpgresource package instead. -func replaceVarsForTest(config *transport_tpg.Config, rs *terraform.ResourceState, linkTmpl string) (string, error) { - return tpgresource.ReplaceVarsForTest(config, rs, linkTmpl) -} diff --git a/google/utils.go b/google/utils.go deleted file mode 100644 index f17de9a97d9..00000000000 --- a/google/utils.go +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -// Contains functions that don't really belong anywhere else. - -package google - -import ( - "reflect" - "regexp" - "time" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - - fwDiags "github.com/hashicorp/terraform-plugin-framework/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "google.golang.org/api/googleapi" -) - -// getRegionFromZone returns the region from a zone for Google cloud. -// This is by removing the last two chars from the zone name to leave the region -// If there aren't enough characters in the input string, an empty string is returned -// e.g. southamerica-west1-a => southamerica-west1 -// -// Deprecated: For backward compatibility getRegionFromZone is still working, -// but all new code should use GetRegionFromZone in the tpgresource package instead. -func getRegionFromZone(zone string) string { - return tpgresource.GetRegionFromZone(zone) -} - -// Infers the region based on the following (in order of priority): -// - `region` field in resource schema -// - region extracted from the `zone` field in resource schema -// - provider-level region -// - region extracted from the provider-level zone -// -// Deprecated: For backward compatibility getRegion is still working, -// but all new code should use GetRegion in the tpgresource package instead. -func getRegion(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetRegion(d, config) -} - -// getProject reads the "project" field from the given resource data and falls -// back to the provider's value if not given. If the provider's value is not -// given, an error is returned. -// -// Deprecated: For backward compatibility getProject is still working, -// but all new code should use GetProject in the tpgresource package instead. -func getProject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetProject(d, config) -} - -// getBillingProject reads the "billing_project" field from the given resource data and falls -// back to the provider's value if not given. If no value is found, an error is returned. -// -// Deprecated: For backward compatibility getBillingProject is still working, -// but all new code should use GetBillingProject in the tpgresource package instead. -func getBillingProject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.GetBillingProject(d, config) -} - -// getProjectFromDiff reads the "project" field from the given diff and falls -// back to the provider's value if not given. If the provider's value is not -// given, an error is returned. -// -// Deprecated: For backward compatibility getProjectFromDiff is still working, -// but all new code should use GetProjectFromDiff in the tpgresource package instead. -func getProjectFromDiff(d *schema.ResourceDiff, config *transport_tpg.Config) (string, error) { - return tpgresource.GetProjectFromDiff(d, config) -} - -// Deprecated: For backward compatibility getRouterLockName is still working, -// but all new code should use GetRouterLockName in the tpgresource package instead. -func getRouterLockName(region string, router string) string { - return tpgresource.GetRouterLockName(region, router) -} - -// Deprecated: For backward compatibility isFailedPreconditionError is still working, -// but all new code should use IsFailedPreconditionError in the tpgresource package instead. -func isFailedPreconditionError(err error) bool { - return tpgresource.IsFailedPreconditionError(err) -} - -// Deprecated: For backward compatibility isConflictError is still working, -// but all new code should use IsConflictError in the tpgresource package instead. -func isConflictError(err error) bool { - return tpgresource.IsConflictError(err) -} - -// gRPC 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). -// -// Deprecated: For backward compatibility isNotFoundGrpcError is still working, -// but all new code should use IsNotFoundGrpcError in the tpgresource package instead. -func isNotFoundGrpcError(err error) bool { - return tpgresource.IsNotFoundGrpcError(err) -} - -// expandLabels pulls the value of "labels" out of a TerraformResourceData as a map[string]string. -// -// Deprecated: For backward compatibility expandLabels is still working, -// but all new code should use ExpandLabels in the tpgresource package instead. -func expandLabels(d tpgresource.TerraformResourceData) map[string]string { - return tpgresource.ExpandLabels(d) -} - -// expandEnvironmentVariables pulls the value of "environment_variables" out of a schema.ResourceData as a map[string]string. -// -// Deprecated: For backward compatibility expandEnvironmentVariables is still working, -// but all new code should use ExpandEnvironmentVariables in the tpgresource package instead. -func expandEnvironmentVariables(d *schema.ResourceData) map[string]string { - return tpgresource.ExpandEnvironmentVariables(d) -} - -// expandBuildEnvironmentVariables pulls the value of "build_environment_variables" out of a schema.ResourceData as a map[string]string. -// -// Deprecated: For backward compatibility expandBuildEnvironmentVariables is still working, -// but all new code should use ExpandBuildEnvironmentVariables in the tpgresource package instead. -func expandBuildEnvironmentVariables(d *schema.ResourceData) map[string]string { - return tpgresource.ExpandBuildEnvironmentVariables(d) -} - -// expandStringMap pulls the value of key out of a TerraformResourceData as a map[string]string. -// -// Deprecated: For backward compatibility expandStringMap is still working, -// but all new code should use ExpandStringMap in the tpgresource package instead. -func expandStringMap(d tpgresource.TerraformResourceData, key string) map[string]string { - return tpgresource.ExpandStringMap(d, key) -} - -// Deprecated: For backward compatibility convertStringMap is still working, -// but all new code should use ConvertStringMap in the tpgresource package instead. -func convertStringMap(v map[string]interface{}) map[string]string { - return tpgresource.ConvertStringMap(v) -} - -// Deprecated: For backward compatibility convertStringArr is still working, -// but all new code should use ConvertStringArr in the tpgresource package instead. -func convertStringArr(ifaceArr []interface{}) []string { - return tpgresource.ConvertStringArr(ifaceArr) -} - -// Deprecated: For backward compatibility convertAndMapStringArr is still working, -// but all new code should use ConvertAndMapStringArr in the tpgresource package instead. -func convertAndMapStringArr(ifaceArr []interface{}, f func(string) string) []string { - return tpgresource.ConvertAndMapStringArr(ifaceArr, f) -} - -// Deprecated: For backward compatibility mapStringArr is still working, -// but all new code should use MapStringArr in the tpgresource package instead. -func mapStringArr(original []string, f func(string) string) []string { - return tpgresource.MapStringArr(original, f) -} - -// Deprecated: For backward compatibility convertStringArrToInterface is still working, -// but all new code should use ConvertStringArrToInterface in the tpgresource package instead. -func convertStringArrToInterface(strs []string) []interface{} { - return tpgresource.ConvertStringArrToInterface(strs) -} - -// Deprecated: For backward compatibility convertStringSet is still working, -// but all new code should use ConvertStringSet in the tpgresource package instead. -func convertStringSet(set *schema.Set) []string { - return tpgresource.ConvertStringSet(set) -} - -// Deprecated: For backward compatibility golangSetFromStringSlice is still working, -// but all new code should use GolangSetFromStringSlice in the tpgresource package instead. -func golangSetFromStringSlice(strings []string) map[string]struct{} { - return tpgresource.GolangSetFromStringSlice(strings) -} - -// Deprecated: For backward compatibility stringSliceFromGolangSet is still working, -// but all new code should use StringSliceFromGolangSet in the tpgresource package instead. -func stringSliceFromGolangSet(sset map[string]struct{}) []string { - return tpgresource.StringSliceFromGolangSet(sset) -} - -// Deprecated: For backward compatibility reverseStringMap is still working, -// but all new code should use ReverseStringMap in the tpgresource package instead. -func reverseStringMap(m map[string]string) map[string]string { - return tpgresource.ReverseStringMap(m) -} - -// Deprecated: For backward compatibility mergeStringMaps is still working, -// but all new code should use MergeStringMaps in the tpgresource package instead. -func mergeStringMaps(a, b map[string]string) map[string]string { - return tpgresource.MergeStringMaps(a, b) -} - -// Deprecated: For backward compatibility mergeSchemas is still working, -// but all new code should use MergeSchemas in the tpgresource package instead. -func mergeSchemas(a, b map[string]*schema.Schema) map[string]*schema.Schema { - return tpgresource.MergeSchemas(a, b) -} - -// Deprecated: For backward compatibility StringToFixed64 is still working, -// but all new code should use StringToFixed64 in the tpgresource package instead. -func StringToFixed64(v string) (int64, error) { - return tpgresource.StringToFixed64(v) -} - -// Deprecated: For backward compatibility extractFirstMapConfig is still working, -// but all new code should use ExtractFirstMapConfig in the tpgresource package instead. -func extractFirstMapConfig(m []interface{}) map[string]interface{} { - return tpgresource.ExtractFirstMapConfig(m) -} - -// Deprecated: For backward compatibility lockedCall is still working, -// but all new code should use LockedCall in the tpgresource package instead. -func lockedCall(lockKey string, f func() error) error { - return transport_tpg.LockedCall(lockKey, f) -} - -// This is a Printf sibling (Nprintf; Named Printf), which handles strings like -// Nprintf("Hello %{target}!", map[string]interface{}{"target":"world"}) == "Hello world!". -// This is particularly useful for generated tests, where we don't want to use Printf, -// since that would require us to generate a very particular ordering of arguments. -// -// Deprecated: For backward compatibility Nprintf is still working, -// but all new code should use Nprintf in the acctest package instead. -func Nprintf(format string, params map[string]interface{}) string { - return acctest.Nprintf(format, params) -} - -// serviceAccountFQN will attempt to generate the fully qualified name in the format of: -// "projects/(-|)/serviceAccounts/@.iam.gserviceaccount.com" -// A project is required if we are trying to build the FQN from a service account id and -// and error will be returned in this case if no project is set in the resource or the -// provider-level config -// -// Deprecated: For backward compatibility serviceAccountFQN is still working, -// but all new code should use ServiceAccountFQN in the tpgresource package instead. -func serviceAccountFQN(serviceAccount string, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.ServiceAccountFQN(serviceAccount, d, config) -} - -// Deprecated: For backward compatibility paginatedListRequest is still working, -// but all new code should use PaginatedListRequest in the tpgresource package instead. -func paginatedListRequest(project, baseUrl, userAgent string, config *transport_tpg.Config, flattener func(map[string]interface{}) []interface{}) ([]interface{}, error) { - return tpgresource.PaginatedListRequest(project, baseUrl, userAgent, config, flattener) -} - -// Deprecated: For backward compatibility getInterconnectAttachmentLink is still working, -// but all new code should use GetInterconnectAttachmentLink in the tpgresource package instead. -func getInterconnectAttachmentLink(config *transport_tpg.Config, project, region, ic, userAgent string) (string, error) { - return tpgresource.GetInterconnectAttachmentLink(config, project, region, ic, userAgent) -} - -// Given two sets of references (with "from" values in self link form), -// determine which need to be added or removed // during an update using -// addX/removeX APIs. -// -// Deprecated: For backward compatibility calcAddRemove is still working, -// but all new code should use CalcAddRemove in the tpgresource package instead. -func calcAddRemove(from []string, to []string) (add, remove []string) { - return tpgresource.CalcAddRemove(from, to) -} - -// Deprecated: For backward compatibility stringInSlice is still working, -// but all new code should use StringInSlice in the tpgresource package instead. -func stringInSlice(arr []string, str string) bool { - return tpgresource.StringInSlice(arr, str) -} - -// Deprecated: For backward compatibility migrateStateNoop is still working, -// but all new code should use MigrateStateNoop in the tpgresource package instead. -func migrateStateNoop(v int, is *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { - return tpgresource.MigrateStateNoop(v, is, meta) -} - -// Deprecated: For backward compatibility expandString is still working, -// but all new code should use ExpandString in the tpgresource package instead. -func expandString(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (string, error) { - return tpgresource.ExpandString(v, d, config) -} - -// Deprecated: For backward compatibility changeFieldSchemaToForceNew is still working, -// but all new code should use ChangeFieldSchemaToForceNew in the tpgresource package instead. -func changeFieldSchemaToForceNew(sch *schema.Schema) { - tpgresource.ChangeFieldSchemaToForceNew(sch) -} - -// Deprecated: For backward compatibility generateUserAgentString is still working, -// but all new code should use GenerateUserAgentString in the tpgresource package instead. -func generateUserAgentString(d tpgresource.TerraformResourceData, currentUserAgent string) (string, error) { - return tpgresource.GenerateUserAgentString(d, currentUserAgent) -} - -// Deprecated: For backward compatibility snakeToPascalCase is still working, -// but all new code should use SnakeToPascalCase in the tpgresource package instead. -func snakeToPascalCase(s string) string { - return tpgresource.SnakeToPascalCase(s) -} - -// Deprecated: For backward compatibility checkStringMap is still working, -// but all new code should use CheckStringMap in the tpgresource package instead. -func checkStringMap(v interface{}) map[string]string { - return tpgresource.CheckStringMap(v) -} - -// return a fake 404 so requests get retried or nested objects are considered deleted -// -// Deprecated: For backward compatibility fake404 is still working, -// but all new code should use Fake404 in the tpgresource package instead. -func fake404(reasonResourceType, resourceName string) *googleapi.Error { - return tpgresource.Fake404(reasonResourceType, resourceName) -} - -// validate name of the gcs bucket. Guidelines are located at https://cloud.google.com/storage/docs/naming-buckets -// this does not attempt to check for IP addresses or close misspellings of "google" -// -// Deprecated: For backward compatibility checkGCSName is still working, -// but all new code should use CheckGCSName in the tpgresource package instead. -func checkGCSName(name string) error { - return tpgresource.CheckGCSName(name) -} - -// checkGoogleIamPolicy makes assertions about the contents of a google_iam_policy data source's policy_data attribute -// -// Deprecated: For backward compatibility checkGoogleIamPolicy is still working, -// but all new code should use CheckGoogleIamPolicy in the tpgresource package instead. -func checkGoogleIamPolicy(value string) error { - return tpgresource.CheckGoogleIamPolicy(value) -} - -// Retries an operation while the canonical error code is FAILED_PRECONDTION -// which indicates there is an incompatible operation already running on the -// cluster. This error can be safely retried until the incompatible operation -// completes, and the newly requested operation can begin. -func retryWhileIncompatibleOperation(timeout time.Duration, lockKey string, f func() error) error { - return tpgresource.RetryWhileIncompatibleOperation(timeout, lockKey, f) -} - -// Deprecated: For backward compatibility frameworkDiagsToSdkDiags is still working, -// but all new code should use FrameworkDiagsToSdkDiags in the tpgresource package instead. -func frameworkDiagsToSdkDiags(fwD fwDiags.Diagnostics) *diag.Diagnostics { - return tpgresource.FrameworkDiagsToSdkDiags(fwD) -} - -// Deprecated: For backward compatibility isEmptyValue is still working, -// but all new code should use IsEmptyValue in the tpgresource package instead. -func isEmptyValue(v reflect.Value) bool { - return tpgresource.IsEmptyValue(v) -} - -// Deprecated: For backward compatibility replaceVars is still working, -// but all new code should use ReplaceVars in the tpgresource package instead. -func ReplaceVars(d tpgresource.TerraformResourceData, config *transport_tpg.Config, linkTmpl string) (string, error) { - return tpgresource.ReplaceVars(d, config, linkTmpl) -} - -// relaceVarsForId shortens variables by running them through GetResourceNameFromSelfLink -// this allows us to use long forms of variables from configs without needing -// custom id formats. For instance: -// accessPolicies/{{access_policy}}/accessLevels/{{access_level}} -// with values: -// access_policy: accessPolicies/foo -// access_level: accessPolicies/foo/accessLevels/bar -// becomes accessPolicies/foo/accessLevels/bar -// -// Deprecated: For backward compatibility replaceVarsForId is still working, -// but all new code should use ReplaceVarsForId in the tpgresource package instead. -func replaceVarsForId(d tpgresource.TerraformResourceData, config *transport_tpg.Config, linkTmpl string) (string, error) { - return tpgresource.ReplaceVarsForId(d, config, linkTmpl) -} - -// ReplaceVars must be done recursively because there are baseUrls that can contain references to regions -// (eg cloudrun service) there aren't any cases known for 2+ recursion but we will track a run away -// substitution as 10+ calls to allow for future use cases. -// -// Deprecated: For backward compatibility replaceVarsRecursive is still working, -// but all new code should use ReplaceVarsRecursive in the tpgresource package instead. -func replaceVarsRecursive(d tpgresource.TerraformResourceData, config *transport_tpg.Config, linkTmpl string, shorten bool, depth int) (string, error) { - return tpgresource.ReplaceVarsRecursive(d, config, linkTmpl, shorten, depth) -} - -// This function replaces references to Terraform properties (in the form of {{var}}) with their value in Terraform -// It also replaces {{project}}, {{project_id_or_project}}, {{region}}, and {{zone}} with their appropriate values -// This function supports URL-encoding the result by prepending '%' to the field name e.g. {{%var}} -// -// Deprecated: For backward compatibility buildReplacementFunc is still working, -// but all new code should use BuildReplacementFunc in the tpgresource package instead. -func buildReplacementFunc(re *regexp.Regexp, d tpgresource.TerraformResourceData, config *transport_tpg.Config, linkTmpl string, shorten bool) (func(string) string, error) { - return tpgresource.BuildReplacementFunc(re, d, config, linkTmpl, shorten) -} diff --git a/google/utils_test.go b/google/utils_test.go deleted file mode 100644 index ee345ac85f0..00000000000 --- a/google/utils_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" -) - -func TestCheckGCSName(t *testing.T) { - valid63 := acctest.RandString(t, 63) - cases := map[string]bool{ - // Valid - "foobar": true, - "foobar1": true, - "12345": true, - "foo_bar_baz": true, - "foo-bar-baz": true, - "foo-bar_baz1": true, - "foo--bar": true, - "foo__bar": true, - "foo-goog": true, - "foo.goog": true, - valid63: true, - fmt.Sprintf("%s.%s.%s", valid63, valid63, valid63): true, - - // Invalid - "goog-foobar": false, - "foobar-google": false, - "-foobar": false, - "foobar-": false, - "_foobar": false, - "foobar_": false, - "fo": false, - "foo$bar": false, - "foo..bar": false, - acctest.RandString(t, 64): false, - fmt.Sprintf("%s.%s.%s.%s", valid63, valid63, valid63, valid63): false, - } - - for bucketName, valid := range cases { - err := tpgresource.CheckGCSName(bucketName) - if valid && err != nil { - t.Errorf("The bucket name %s was expected to pass validation and did not pass.", bucketName) - } else if !valid && err == nil { - t.Errorf("The bucket name %s was NOT expected to pass validation and passed.", bucketName) - } - } -} diff --git a/google/validation.go b/google/validation.go deleted file mode 100644 index 2eaa1b7b6bd..00000000000 --- a/google/validation.go +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-google/google/verify" -) - -const ( - // Deprecated: For backward compatibility ProjectRegex is still working, - // but all new code should use ProjectRegex in the verify package instead. - // Copied from the official Google Cloud auto-generated client. - ProjectRegex = verify.ProjectRegex - // Deprecated: For backward compatibility ProjectRegexWildCard is still working, - // but all new code should use ProjectRegexWildCard in the verify package instead. - ProjectRegexWildCard = verify.ProjectRegexWildCard - // Deprecated: For backward compatibility RegionRegex is still working, - // but all new code should use RegionRegex in the verify package instead. - RegionRegex = verify.RegionRegex - // Deprecated: For backward compatibility SubnetworkRegex is still working, - // but all new code should use SubnetworkRegex in the verify package instead. - SubnetworkRegex = verify.SubnetworkRegex - - // Deprecated: For backward compatibility SubnetworkLinkRegex is still working, - // but all new code should use SubnetworkLinkRegex in the verify package instead. - SubnetworkLinkRegex = verify.SubnetworkLinkRegex - - // Deprecated: For backward compatibility RFC1035NameTemplate is still working, - // but all new code should use RFC1035NameTemplate in the verify package instead. - RFC1035NameTemplate = verify.RFC1035NameTemplate - // Deprecated: For backward compatibility CloudIoTIdRegex is still working, - // but all new code should use CloudIoTIdRegex in the verify package instead. - CloudIoTIdRegex = verify.CloudIoTIdRegex - - // Deprecated: For backward compatibility ComputeServiceAccountNameRegex is still working, - // but all new code should use ComputeServiceAccountNameRegex in the verify package instead. - // Format of default Compute service accounts created by Google - // ${PROJECT_ID}-compute@developer.gserviceaccount.com where PROJECT_ID is an int64 (max 20 digits) - ComputeServiceAccountNameRegex = verify.ComputeServiceAccountNameRegex - - // Deprecated: For backward compatibility IAMCustomRoleIDRegex is still working, - // but all new code should use IAMCustomRoleIDRegex in the verify package instead. - // https://cloud.google.com/iam/docs/understanding-custom-roles#naming_the_role - IAMCustomRoleIDRegex = verify.IAMCustomRoleIDRegex - - // Deprecated: For backward compatibility ADDomainNameRegex is still working, - // but all new code should use ADDomainNameRegex in the verify package instead. - // https://cloud.google.com/managed-microsoft-ad/reference/rest/v1/projects.locations.global.domains/create#query-parameters - ADDomainNameRegex = verify.ADDomainNameRegex -) - -var ( - // Deprecated: For backward compatibility ServiceAccountNameRegex is still working, - // but all new code should use ServiceAccountNameRegex in the verify package instead. - // Service account name must have a length between 6 and 30. - // The first and last characters have different restrictions, than - // the middle characters. The middle characters length must be between - // 4 and 28 since the first and last character are excluded. - ServiceAccountNameRegex = verify.ServiceAccountNameRegex - - // Deprecated: For backward compatibility ServiceAccountLinkRegexPrefix is still working, - // but all new code should use ServiceAccountLinkRegexPrefix in the verify package instead. - ServiceAccountLinkRegexPrefix = verify.ServiceAccountLinkRegexPrefix - // Deprecated: For backward compatibility PossibleServiceAccountNames is still working, - // but all new code should use PossibleServiceAccountNames in the verify package instead. - PossibleServiceAccountNames = verify.PossibleServiceAccountNames - // Deprecated: For backward compatibility ServiceAccountLinkRegex is still working, - // but all new code should use ServiceAccountLinkRegex in the verify package instead. - ServiceAccountLinkRegex = verify.ServiceAccountLinkRegex - - // Deprecated: For backward compatibility ServiceAccountKeyNameRegex is still working, - // but all new code should use ServiceAccountKeyNameRegex in the verify package instead. - ServiceAccountKeyNameRegex = verify.ServiceAccountKeyNameRegex - - // Deprecated: For backward compatibility CreatedServiceAccountNameRegex is still working, - // but all new code should use CreatedServiceAccountNameRegex in the verify package instead. - // Format of service accounts created through the API - CreatedServiceAccountNameRegex = verify.CreatedServiceAccountNameRegex - - // Deprecated: For backward compatibility ServiceDefaultAccountNameRegex is still working, - // but all new code should use ServiceDefaultAccountNameRegex in the verify package instead. - // Format of service-created service account - // examples are: - // $PROJECTID@cloudbuild.gserviceaccount.com - // $PROJECTID@cloudservices.gserviceaccount.com - // $PROJECTID@appspot.gserviceaccount.com - ServiceDefaultAccountNameRegex = verify.ServiceDefaultAccountNameRegex - - // Deprecated: For backward compatibility ProjectNameInDNSFormRegex is still working, - // but all new code should use ProjectNameInDNSFormRegex in the verify package instead. - ProjectNameInDNSFormRegex = verify.ProjectNameInDNSFormRegex - // Deprecated: For backward compatibility ProjectNameRegex is still working, - // but all new code should use ProjectNameRegex in the verify package instead. - ProjectNameRegex = verify.ProjectNameRegex - - // Valid range for Cloud Router ASN values as per RFC6996 - // https://tools.ietf.org/html/rfc6996 - // Must be explicitly int64 to avoid overflow when building Terraform for 32bit architectures - // Deprecated: For backward compatibility Rfc6996Asn16BitMin is still working, - // but all new code should use Rfc6996Asn16BitMin in the verify package instead. - Rfc6996Asn16BitMin = verify.Rfc6996Asn16BitMin - // Deprecated: For backward compatibility Rfc6996Asn16BitMax is still working, - // but all new code should use Rfc6996Asn16BitMax in the verify package instead. - Rfc6996Asn16BitMax = verify.Rfc6996Asn16BitMax - // Deprecated: For backward compatibility Rfc6996Asn32BitMin is still working, - // but all new code should use Rfc6996Asn32BitMin in the verify package instead. - Rfc6996Asn32BitMin = verify.Rfc6996Asn32BitMin - // Deprecated: For backward compatibility Rfc6996Asn32BitMax is still working, - // but all new code should use Rfc6996Asn32BitMax in the verify package instead. - Rfc6996Asn32BitMax = verify.Rfc6996Asn32BitMax - // Deprecated: For backward compatibility GcpRouterPartnerAsn is still working, - // but all new code should use Rfc6996Asn16BitMin in the verify package instead. - GcpRouterPartnerAsn = verify.GcpRouterPartnerAsn -) - -// Deprecated: For backward compatibility rfc1918Networks is still working, -// but all new code should use Rfc1918Networks in the verify package instead. -var rfc1918Networks = verify.Rfc1918Networks - -// Deprecated: For backward compatibility validateGCEName is still working, -// but all new code should use ValidateGCEName in the verify package instead. -// validateGCEName ensures that a field matches the requirements for Compute Engine resource names -// https://cloud.google.com/compute/docs/naming-resources#resource-name-format -func validateGCEName(v interface{}, k string) (ws []string, errors []error) { - return verify.ValidateGCEName(v, k) -} - -// Deprecated: For backward compatibility validateRFC6996Asn is still working, -// but all new code should use ValidateRFC6996Asn in the verify package instead. -// Ensure that the BGP ASN value of Cloud Router is a valid value as per RFC6996 or a value of 16550 -func validateRFC6996Asn(v interface{}, k string) (ws []string, errors []error) { - return verify.ValidateRFC6996Asn(v, k) -} - -// Deprecated: For backward compatibility validateRegexp is still working, -// but all new code should use ValidateRegexp in the verify package instead. -func validateRegexp(re string) schema.SchemaValidateFunc { - return verify.ValidateRegexp(re) -} - -// Deprecated: For backward compatibility validateEnum is still working, -// but all new code should use ValidateEnum in the verify package instead. -func validateEnum(values []string) schema.SchemaValidateFunc { - return verify.ValidateEnum(values) -} - -// Deprecated: For backward compatibility validateRFC1918Network is still working, -// but all new code should use ValidateRFC1918Network in the verify package instead. -func validateRFC1918Network(min, max int) schema.SchemaValidateFunc { - return verify.ValidateRFC1918Network(min, max) -} - -// Deprecated: For backward compatibility validateRFC3339Time is still working, -// but all new code should use ValidateRFC3339Time in the verify package instead. -func validateRFC3339Time(v interface{}, k string) (warnings []string, errors []error) { - return verify.ValidateRFC3339Time(v, k) -} - -// Deprecated: For backward compatibility validateRFC1035Name is still working, -// but all new code should use ValidateRFC1035Name in the verify package instead. -func validateRFC1035Name(min, max int) schema.SchemaValidateFunc { - return verify.ValidateRFC1035Name(min, max) -} - -// Deprecated: For backward compatibility validateIpCidrRange is still working, -// but all new code should use ValidateIpCidrRange in the verify package instead. -func validateIpCidrRange(v interface{}, k string) (warnings []string, errors []error) { - return verify.ValidateIpCidrRange(v, k) -} - -// Deprecated: For backward compatibility validateIAMCustomRoleID is still working, -// but all new code should use ValidateIAMCustomRoleID in the verify package instead. -func validateIAMCustomRoleID(v interface{}, k string) (warnings []string, errors []error) { - return verify.ValidateIAMCustomRoleID(v, k) -} - -// Deprecated: For backward compatibility orEmpty is still working, -// but all new code should use OrEmpty in the verify package instead. -func orEmpty(f schema.SchemaValidateFunc) schema.SchemaValidateFunc { - return verify.OrEmpty(f) -} - -// Deprecated: For backward compatibility validateProjectID is still working, -// but all new code should use ValidateProjectID in the verify package instead. -func validateProjectID() schema.SchemaValidateFunc { - return verify.ValidateProjectID() -} - -// Deprecated: For backward compatibility validateDSProjectID is still working, -// but all new code should use ValidateDSProjectID in the verify package instead. -func validateDSProjectID() schema.SchemaValidateFunc { - return verify.ValidateDSProjectID() -} - -// Deprecated: For backward compatibility validateProjectName is still working, -// but all new code should use ValidateProjectName in the verify package instead. -func validateProjectName() schema.SchemaValidateFunc { - return verify.ValidateProjectName() -} - -// Deprecated: For backward compatibility validateDuration is still working, -// but all new code should use ValidateDuration in the verify package instead. -func validateDuration() schema.SchemaValidateFunc { - return verify.ValidateDuration() -} - -// Deprecated: For backward compatibility validateNonNegativeDuration is still working, -// but all new code should use ValidateNonNegativeDuration in the verify package instead. -func validateNonNegativeDuration() schema.SchemaValidateFunc { - return verify.ValidateNonNegativeDuration() -} - -// Deprecated: For backward compatibility validateIpAddress is still working, -// but all new code should use ValidateIpAddress in the verify package instead. -func validateIpAddress(i interface{}, val string) ([]string, []error) { - return verify.ValidateIpAddress(i, val) -} - -// Deprecated: For backward compatibility validateBase64String is still working, -// but all new code should use ValidateBase64String in the verify package instead. -func validateBase64String(i interface{}, val string) ([]string, []error) { - return verify.ValidateBase64String(i, val) -} - -// Deprecated: For backward compatibility StringNotInSlice is still working, -// but all new code should use StringNotInSlice in the verify package instead. -// StringNotInSlice returns a SchemaValidateFunc which tests if the provided value -// is of type string and that it matches none of the element in the invalid slice. -// if ignorecase is true, case is ignored. -func StringNotInSlice(invalid []string, ignoreCase bool) schema.SchemaValidateFunc { - return verify.StringNotInSlice(invalid, ignoreCase) -} - -// Deprecated: For backward compatibility validateHourlyOnly is still working, -// but all new code should use ValidateHourlyOnly in the verify package instead. -// Ensure that hourly timestamp strings "HH:MM" have the minutes zeroed out for hourly only inputs -func validateHourlyOnly(val interface{}, key string) (warns []string, errs []error) { - return verify.ValidateHourlyOnly(val, key) -} - -// Deprecated: For backward compatibility validateRFC3339Date is still working, -// but all new code should use ValidateRFC3339Date in the verify package instead. -func validateRFC3339Date(v interface{}, k string) (warnings []string, errors []error) { - return verify.ValidateRFC3339Date(v, k) -} - -// Deprecated: For backward compatibility validateADDomainName is still working, -// but all new code should use ValidateADDomainName in the verify package instead. -func validateADDomainName() schema.SchemaValidateFunc { - return verify.ValidateADDomainName() -} diff --git a/google/vcr_utils.go b/google/vcr_utils.go deleted file mode 100644 index 01f8b3cc272..00000000000 --- a/google/vcr_utils.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "testing" - - "github.com/hashicorp/terraform-provider-google/google/acctest" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func isVcrEnabled() bool { - return acctest.IsVcrEnabled() -} - -// VcrTest is a wrapper for resource.Test to swap out providers for VCR providers and handle VCR specific things -// Can be called when VCR is not enabled, and it will behave as normal -func VcrTest(t *testing.T, c resource.TestCase) { - acctest.VcrTest(t, c) -} diff --git a/google/vertex_ai_operation.go b/google/vertex_ai_operation.go deleted file mode 100644 index d446d750477..00000000000 --- a/google/vertex_ai_operation.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 -package google - -import ( - "time" - - "github.com/hashicorp/terraform-provider-google/google/services/vertexai" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -// nolint: deadcode,unused -// -// Deprecated: For backward compatibility VertexAIOperationWaitTimeWithResponse is still working, -// but all new code should use VertexAIOperationWaitTimeWithResponse in the vertexai package instead. -func VertexAIOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return vertexai.VertexAIOperationWaitTimeWithResponse(config, op, response, project, activity, userAgent, timeout) -} - -// Deprecated: For backward compatibility VertexAIOperationWaitTime is still working, -// but all new code should use VertexAIOperationWaitTime in the vertexai package instead. -func VertexAIOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - return vertexai.VertexAIOperationWaitTime(config, op, project, activity, userAgent, timeout) -} diff --git a/scripts/diff.go b/scripts/diff.go index 9b9ba3bbfba..bc824100976 100644 --- a/scripts/diff.go +++ b/scripts/diff.go @@ -9,8 +9,8 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - googleOld "github.com/hashicorp/terraform-provider-clean-google/google" - google "github.com/hashicorp/terraform-provider-google/google" + googleOld "github.com/hashicorp/terraform-provider-clean-google/google/provider" + google "github.com/hashicorp/terraform-provider-google/google/provider" ) var verbose bool