From 0642dc3ff88bac3c669dd33fc50533c6dc898d85 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 23 Mar 2022 10:00:11 -0700 Subject: [PATCH] chore(all): auto-regenerate gapics (#5785) This is an auto-generated regeneration of the gapic clients by cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is submitted, genbot will update this PR with a newer dependency to the newer version of genproto and assign reviewers to this PR. If you have been assigned to review this PR, please: - Ensure that the version of genproto in go.mod has been updated. - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/780 Changes: chore(documentai): remove unused imports PiperOrigin-RevId: 436716640 Source-Link: https://github.com/googleapis/googleapis/commit/ab8c7d2054227e02e9a897f8058543bc9380be0c chore(osconfig/agentendpoint): remove unused imports PiperOrigin-RevId: 436511258 Source-Link: https://github.com/googleapis/googleapis/commit/34b98de13faa4813f2e818d7d3158912176a66b8 chore(certificatemanager): Configure Ruby builds for cloudoptimization and certificatemanager PiperOrigin-RevId: 436334879 Source-Link: https://github.com/googleapis/googleapis/commit/4779e9f6a4686e5885dbfab63df95cc809dca1ee docs(dialogflow/cx): improved docs format PiperOrigin-RevId: 436315342 Source-Link: https://github.com/googleapis/googleapis/commit/321e5e46e59bb22192a4992a0dde4a9e1ebdfe74 feat(metastore): Added DatabaseType field for the type of backing store used feat: Added AVRO DatabaseDumpSpec for importing and exporting Avro files feat: Added additional endTime field for MetadataImports feat: Added RESTORING status on Backups feat: Added support to record the services that are restoring the backup feat: Added configuration for Dataplex integration feat: Added support for IAM management for metadata resources feat: Added AuxiliaryVersionConfig for configuring the auxiliary hive versions during creation or update of the DPMS instance feat: Added NetworkConfig for exposing the DPMS endpoint in multiple subnetworks using PSC (this skips the need for VPC peering) feat: Added EncryptionConfig which contains information used to configure the Dataproc Metastore service to encrypt customer data at rest (CMEK) docs: formatting improvements PiperOrigin-RevId: 436271267 Source-Link: https://github.com/googleapis/googleapis/commit/463cacaf4733629b8a37803796777856013c27fc Synchronize new proto/yaml changes. PiperOrigin-RevId: 436114471 Source-Link: https://github.com/googleapis/googleapis/commit/6379d5fe706781af6682447f77f20d18b4db05b2 docs(dialogflow): added explanation for SuggestionResult PiperOrigin-RevId: 435670355 Source-Link: https://github.com/googleapis/googleapis/commit/5d85995dbd61d6a0b331f93e6244876cdd366e8c docs(dialogflow/cx): added explanation for uri fields in resources docs: improved docs format PiperOrigin-RevId: 435479428 Source-Link: https://github.com/googleapis/googleapis/commit/4dd75c267e50b9d620cbada502212899c614b932 docs(talent): Added functionality in the companyDisplayNames filter to support fuzzy matching PiperOrigin-RevId: 435467010 Source-Link: https://github.com/googleapis/googleapis/commit/cb382857a71e5fbfbddd2f276fd4395754318a40 --- compute/go.mod | 2 +- compute/go.sum | 3 +- go.mod | 2 +- go.sum | 4 +- internal/generated/snippets/go.mod | 5 +- internal/generated/snippets/go.sum | 4 +- .../BatchOptimizeTours/main.go | 53 ++++++++ .../FleetRoutingClient/OptimizeTours/main.go | 48 +++++++ .../DatabaseAdminClient/CopyBackup/main.go | 53 ++++++++ internal/godocfx/go.sum | 4 +- .../apiv1alpha/dataproc_metastore_client.go | 10 +- metastore/go.mod | 2 +- metastore/go.sum | 3 +- .../database/apiv1/database_admin_client.go | 119 ++++++++++++++++++ .../database_admin_client_example_test.go | 25 ++++ .../admin/database/apiv1/gapic_metadata.json | 5 + spanner/go.mod | 2 +- spanner/go.sum | 4 +- 18 files changed, 329 insertions(+), 19 deletions(-) create mode 100644 internal/generated/snippets/optimization/apiv1/FleetRoutingClient/BatchOptimizeTours/main.go create mode 100644 internal/generated/snippets/optimization/apiv1/FleetRoutingClient/OptimizeTours/main.go create mode 100644 internal/generated/snippets/spanner/admin/database/apiv1/DatabaseAdminClient/CopyBackup/main.go diff --git a/compute/go.mod b/compute/go.mod index d343ab94ddd9..3cb0bc61d21f 100644 --- a/compute/go.mod +++ b/compute/go.mod @@ -7,7 +7,7 @@ require ( github.com/google/go-cmp v0.5.7 github.com/googleapis/gax-go/v2 v2.2.0 google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 + google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/compute/go.sum b/compute/go.sum index 8085855382ab..d821d9165e96 100644 --- a/compute/go.sum +++ b/compute/go.sum @@ -534,8 +534,9 @@ google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 h1:FglFEfyj61zP3c6LgjmVHxYxZWXYul9oiS1EZqD5gLc= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/go.mod b/go.mod index 19176735d1da..234290daee04 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 + google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/go.sum b/go.sum index 4c8769857a56..e4797bdd40e3 100644 --- a/go.sum +++ b/go.sum @@ -556,8 +556,8 @@ google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 h1:3n0D2NdPGm0g0wrVJzXJWW5CBOoqgGBkDX9cRMJHZAY= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/generated/snippets/go.mod b/internal/generated/snippets/go.mod index 0a94014b30aa..e529ef9a84a0 100644 --- a/internal/generated/snippets/go.mod +++ b/internal/generated/snippets/go.mod @@ -69,6 +69,7 @@ require ( cloud.google.com/go/networkmanagement v1.0.0 cloud.google.com/go/networksecurity v0.1.0 cloud.google.com/go/notebooks v0.1.0 + cloud.google.com/go/optimization v0.0.0-00010101000000-000000000000 cloud.google.com/go/orchestration v0.1.0 cloud.google.com/go/orgpolicy v1.0.0 cloud.google.com/go/osconfig v1.2.0 @@ -112,7 +113,7 @@ require ( cloud.google.com/go/workflows v1.1.0 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 + google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 ) replace cloud.google.com/go/storagetransfer => ../../../storagetransfer @@ -336,3 +337,5 @@ replace cloud.google.com/go/storage => ../../../storage replace cloud.google.com/go/dataplex => ../../../dataplex replace cloud.google.com/go/certificatemanager => ../../../certificatemanager + +replace cloud.google.com/go/optimization => ../../../optimization diff --git a/internal/generated/snippets/go.sum b/internal/generated/snippets/go.sum index 93ade36cb175..832bff3f2bc9 100644 --- a/internal/generated/snippets/go.sum +++ b/internal/generated/snippets/go.sum @@ -185,9 +185,11 @@ google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 h1:3n0D2NdPGm0g0wrVJzXJWW5CBOoqgGBkDX9cRMJHZAY= google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/internal/generated/snippets/optimization/apiv1/FleetRoutingClient/BatchOptimizeTours/main.go b/internal/generated/snippets/optimization/apiv1/FleetRoutingClient/BatchOptimizeTours/main.go new file mode 100644 index 000000000000..7afdc0622a45 --- /dev/null +++ b/internal/generated/snippets/optimization/apiv1/FleetRoutingClient/BatchOptimizeTours/main.go @@ -0,0 +1,53 @@ +// Copyright 2022 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START cloudoptimization_v1_generated_FleetRouting_BatchOptimizeTours_sync] + +package main + +import ( + "context" + + optimization "cloud.google.com/go/optimization/apiv1" + optimizationpb "google.golang.org/genproto/googleapis/cloud/optimization/v1" +) + +func main() { + ctx := context.Background() + c, err := optimization.NewFleetRoutingClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &optimizationpb.BatchOptimizeToursRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/optimization/v1#BatchOptimizeToursRequest. + } + op, err := c.BatchOptimizeTours(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudoptimization_v1_generated_FleetRouting_BatchOptimizeTours_sync] diff --git a/internal/generated/snippets/optimization/apiv1/FleetRoutingClient/OptimizeTours/main.go b/internal/generated/snippets/optimization/apiv1/FleetRoutingClient/OptimizeTours/main.go new file mode 100644 index 000000000000..0181a539c723 --- /dev/null +++ b/internal/generated/snippets/optimization/apiv1/FleetRoutingClient/OptimizeTours/main.go @@ -0,0 +1,48 @@ +// Copyright 2022 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START cloudoptimization_v1_generated_FleetRouting_OptimizeTours_sync] + +package main + +import ( + "context" + + optimization "cloud.google.com/go/optimization/apiv1" + optimizationpb "google.golang.org/genproto/googleapis/cloud/optimization/v1" +) + +func main() { + ctx := context.Background() + c, err := optimization.NewFleetRoutingClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &optimizationpb.OptimizeToursRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/optimization/v1#OptimizeToursRequest. + } + resp, err := c.OptimizeTours(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END cloudoptimization_v1_generated_FleetRouting_OptimizeTours_sync] diff --git a/internal/generated/snippets/spanner/admin/database/apiv1/DatabaseAdminClient/CopyBackup/main.go b/internal/generated/snippets/spanner/admin/database/apiv1/DatabaseAdminClient/CopyBackup/main.go new file mode 100644 index 000000000000..5f3de2d011db --- /dev/null +++ b/internal/generated/snippets/spanner/admin/database/apiv1/DatabaseAdminClient/CopyBackup/main.go @@ -0,0 +1,53 @@ +// Copyright 2022 Google LLC +// +// 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. + +// Code generated by cloud.google.com/go/internal/gapicgen/gensnippets. DO NOT EDIT. + +// [START spanner_v1_generated_DatabaseAdmin_CopyBackup_sync] + +package main + +import ( + "context" + + database "cloud.google.com/go/spanner/admin/database/apiv1" + databasepb "google.golang.org/genproto/googleapis/spanner/admin/database/v1" +) + +func main() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &databasepb.CopyBackupRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/admin/database/v1#CopyBackupRequest. + } + op, err := c.CopyBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +// [END spanner_v1_generated_DatabaseAdmin_CopyBackup_sync] diff --git a/internal/godocfx/go.sum b/internal/godocfx/go.sum index 726c4a327806..a2fec2d69820 100644 --- a/internal/godocfx/go.sum +++ b/internal/godocfx/go.sum @@ -222,8 +222,8 @@ google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 h1:3n0D2NdPGm0g0wrVJzXJWW5CBOoqgGBkDX9cRMJHZAY= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= diff --git a/metastore/apiv1alpha/dataproc_metastore_client.go b/metastore/apiv1alpha/dataproc_metastore_client.go index 006ad2eca316..70d08d186688 100644 --- a/metastore/apiv1alpha/dataproc_metastore_client.go +++ b/metastore/apiv1alpha/dataproc_metastore_client.go @@ -186,8 +186,8 @@ type internalDataprocMetastoreClient interface { // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // // Configures and manages metastore services. -// Metastore services are fully managed, highly available, auto-scaled, -// auto-healing, OSS-native deployments of technical metadata management +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management // software. Each metastore service exposes a network endpoint through which // metadata queries are served. Metadata queries can originate from a variety // of sources, including Apache Hive, Apache Presto, and Apache Spark. @@ -348,7 +348,7 @@ func (c *DataprocMetastoreClient) GetBackup(ctx context.Context, req *metastorep return c.internalClient.GetBackup(ctx, req, opts...) } -// CreateBackup creates a new Backup in a given project and location. +// CreateBackup creates a new backup in a given project and location. func (c *DataprocMetastoreClient) CreateBackup(ctx context.Context, req *metastorepb.CreateBackupRequest, opts ...gax.CallOption) (*CreateBackupOperation, error) { return c.internalClient.CreateBackup(ctx, req, opts...) } @@ -399,8 +399,8 @@ type dataprocMetastoreGRPCClient struct { // The returned client must be Closed when it is done being used to clean up its underlying connections. // // Configures and manages metastore services. -// Metastore services are fully managed, highly available, auto-scaled, -// auto-healing, OSS-native deployments of technical metadata management +// Metastore services are fully managed, highly available, autoscaled, +// autohealing, OSS-native deployments of technical metadata management // software. Each metastore service exposes a network endpoint through which // metadata queries are served. Metadata queries can originate from a variety // of sources, including Apache Hive, Apache Presto, and Apache Spark. diff --git a/metastore/go.mod b/metastore/go.mod index 1a6581466c18..96db5d0ccc50 100644 --- a/metastore/go.mod +++ b/metastore/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.100.2 github.com/googleapis/gax-go/v2 v2.2.0 google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 + google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/metastore/go.sum b/metastore/go.sum index c42e86ef06b8..f30ca85bf22b 100644 --- a/metastore/go.sum +++ b/metastore/go.sum @@ -535,8 +535,9 @@ google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 h1:FglFEfyj61zP3c6LgjmVHxYxZWXYul9oiS1EZqD5gLc= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/spanner/admin/database/apiv1/database_admin_client.go b/spanner/admin/database/apiv1/database_admin_client.go index 7f6fe232d281..f0b2f9f7cabd 100644 --- a/spanner/admin/database/apiv1/database_admin_client.go +++ b/spanner/admin/database/apiv1/database_admin_client.go @@ -53,6 +53,7 @@ type DatabaseAdminCallOptions struct { GetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption CreateBackup []gax.CallOption + CopyBackup []gax.CallOption GetBackup []gax.CallOption UpdateBackup []gax.CallOption DeleteBackup []gax.CallOption @@ -152,6 +153,7 @@ func defaultDatabaseAdminCallOptions() *DatabaseAdminCallOptions { }, TestIamPermissions: []gax.CallOption{}, CreateBackup: []gax.CallOption{}, + CopyBackup: []gax.CallOption{}, GetBackup: []gax.CallOption{ gax.WithRetry(func() gax.Retryer { return gax.OnCodes([]codes.Code{ @@ -246,6 +248,8 @@ type internalDatabaseAdminClient interface { TestIamPermissions(context.Context, *iampb.TestIamPermissionsRequest, ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) CreateBackup(context.Context, *databasepb.CreateBackupRequest, ...gax.CallOption) (*CreateBackupOperation, error) CreateBackupOperation(name string) *CreateBackupOperation + CopyBackup(context.Context, *databasepb.CopyBackupRequest, ...gax.CallOption) (*CopyBackupOperation, error) + CopyBackupOperation(name string) *CopyBackupOperation GetBackup(context.Context, *databasepb.GetBackupRequest, ...gax.CallOption) (*databasepb.Backup, error) UpdateBackup(context.Context, *databasepb.UpdateBackupRequest, ...gax.CallOption) (*databasepb.Backup, error) DeleteBackup(context.Context, *databasepb.DeleteBackupRequest, ...gax.CallOption) error @@ -425,6 +429,28 @@ func (c *DatabaseAdminClient) CreateBackupOperation(name string) *CreateBackupOp return c.internalClient.CreateBackupOperation(name) } +// CopyBackup starts copying a Cloud Spanner Backup. +// The returned backup [long-running operation][google.longrunning.Operation] +// will have a name of the format +// projects//instances//backups//operations/ +// and can be used to track copying of the backup. The operation is associated +// with the destination backup. +// The metadata field type is +// CopyBackupMetadata. +// The response field type is +// Backup, if successful. Cancelling the returned operation will stop the +// copying and delete the backup. +// Concurrent CopyBackup requests can run on the same source backup. +func (c *DatabaseAdminClient) CopyBackup(ctx context.Context, req *databasepb.CopyBackupRequest, opts ...gax.CallOption) (*CopyBackupOperation, error) { + return c.internalClient.CopyBackup(ctx, req, opts...) +} + +// CopyBackupOperation returns a new CopyBackupOperation from a given name. +// The name must be that of a previously created CopyBackupOperation, possibly from a different process. +func (c *DatabaseAdminClient) CopyBackupOperation(name string) *CopyBackupOperation { + return c.internalClient.CopyBackupOperation(name) +} + // GetBackup gets metadata on a pending or completed Backup. func (c *DatabaseAdminClient) GetBackup(ctx context.Context, req *databasepb.GetBackupRequest, opts ...gax.CallOption) (*databasepb.Backup, error) { return c.internalClient.GetBackup(ctx, req, opts...) @@ -851,6 +877,30 @@ func (c *databaseAdminGRPCClient) CreateBackup(ctx context.Context, req *databas }, nil } +func (c *databaseAdminGRPCClient) CopyBackup(ctx context.Context, req *databasepb.CopyBackupRequest, opts ...gax.CallOption) (*CopyBackupOperation, error) { + if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { + cctx, cancel := context.WithTimeout(ctx, 3600000*time.Millisecond) + defer cancel() + ctx = cctx + } + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append((*c.CallOptions).CopyBackup[0:len((*c.CallOptions).CopyBackup):len((*c.CallOptions).CopyBackup)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.databaseAdminClient.CopyBackup(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &CopyBackupOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, resp), + }, nil +} + func (c *databaseAdminGRPCClient) GetBackup(ctx context.Context, req *databasepb.GetBackupRequest, opts ...gax.CallOption) (*databasepb.Backup, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 3600000*time.Millisecond) @@ -1072,6 +1122,75 @@ func (c *databaseAdminGRPCClient) ListBackupOperations(ctx context.Context, req return it } +// CopyBackupOperation manages a long-running operation from CopyBackup. +type CopyBackupOperation struct { + lro *longrunning.Operation +} + +// CopyBackupOperation returns a new CopyBackupOperation from a given name. +// The name must be that of a previously created CopyBackupOperation, possibly from a different process. +func (c *databaseAdminGRPCClient) CopyBackupOperation(name string) *CopyBackupOperation { + return &CopyBackupOperation{ + lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *CopyBackupOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*databasepb.Backup, error) { + var resp databasepb.Backup + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *CopyBackupOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*databasepb.Backup, error) { + var resp databasepb.Backup + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *CopyBackupOperation) Metadata() (*databasepb.CopyBackupMetadata, error) { + var meta databasepb.CopyBackupMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *CopyBackupOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *CopyBackupOperation) Name() string { + return op.lro.Name() +} + // CreateBackupOperation manages a long-running operation from CreateBackup. type CreateBackupOperation struct { lro *longrunning.Operation diff --git a/spanner/admin/database/apiv1/database_admin_client_example_test.go b/spanner/admin/database/apiv1/database_admin_client_example_test.go index 8906155f6358..a134824b7c2f 100644 --- a/spanner/admin/database/apiv1/database_admin_client_example_test.go +++ b/spanner/admin/database/apiv1/database_admin_client_example_test.go @@ -254,6 +254,31 @@ func ExampleDatabaseAdminClient_CreateBackup() { _ = resp } +func ExampleDatabaseAdminClient_CopyBackup() { + ctx := context.Background() + c, err := database.NewDatabaseAdminClient(ctx) + if err != nil { + // TODO: Handle error. + } + defer c.Close() + + req := &databasepb.CopyBackupRequest{ + // TODO: Fill request struct fields. + // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/admin/database/v1#CopyBackupRequest. + } + op, err := c.CopyBackup(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + func ExampleDatabaseAdminClient_GetBackup() { ctx := context.Background() c, err := database.NewDatabaseAdminClient(ctx) diff --git a/spanner/admin/database/apiv1/gapic_metadata.json b/spanner/admin/database/apiv1/gapic_metadata.json index e99be310982a..f2eb5b8a3bdf 100644 --- a/spanner/admin/database/apiv1/gapic_metadata.json +++ b/spanner/admin/database/apiv1/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "DatabaseAdminClient", "rpcs": { + "CopyBackup": { + "methods": [ + "CopyBackup" + ] + }, "CreateBackup": { "methods": [ "CreateBackup" diff --git a/spanner/go.mod b/spanner/go.mod index 97e1ad55fe09..7464ac58ab81 100644 --- a/spanner/go.mod +++ b/spanner/go.mod @@ -11,7 +11,7 @@ require ( go.opencensus.io v0.23.0 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/api v0.73.0 - google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 + google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/spanner/go.sum b/spanner/go.sum index afb58a8d7329..d0cbc30097dd 100644 --- a/spanner/go.sum +++ b/spanner/go.sum @@ -550,8 +550,8 @@ google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2 h1:3n0D2NdPGm0g0wrVJzXJWW5CBOoqgGBkDX9cRMJHZAY= -google.golang.org/genproto v0.0.0-20220322021311-435b647f9ef2/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14 h1:17TOyVD+9MLIDtDJW9PdtMuVT7gNLEkN+G/xFYjZmr8= +google.golang.org/genproto v0.0.0-20220323144105-ec3c684e5b14/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=