Skip to content

Commit

Permalink
feat(spanner): Add instance partitions field in backup proto
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 726160420

Source-Link: googleapis/googleapis@1185fe5

Source-Link: googleapis/googleapis-gen@d1ab008
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuU3Bhbm5lci5BZG1pbi5EYXRhYmFzZS5WMS8uT3dsQm90LnlhbWwiLCJoIjoiZDFhYjAwODgyODI5N2JhMWJjNWUwZDc5Njc4ZjcyNWY5NTU4MzNkNyJ9
  • Loading branch information
gcf-owl-bot[bot] committed Feb 12, 2025
1 parent f4430c8 commit 94b0df7
Show file tree
Hide file tree
Showing 168 changed files with 51,413 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_AddSplitPoints_async_flattened]
using Google.Cloud.Spanner.Admin.Database.V1;
using System.Collections.Generic;
using System.Threading.Tasks;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for AddSplitPointsAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task AddSplitPointsAsync()
{
// Create client
DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync();
// Initialize request argument(s)
string database = "projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]";
IEnumerable<SplitPoints> splitPoints = new SplitPoints[] { new SplitPoints(), };
// Make the request
AddSplitPointsResponse response = await databaseAdminClient.AddSplitPointsAsync(database, splitPoints);
}
}
// [END spanner_v1_generated_DatabaseAdmin_AddSplitPoints_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_AddSplitPoints_async]
using Google.Cloud.Spanner.Admin.Database.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for AddSplitPointsAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task AddSplitPointsRequestObjectAsync()
{
// Create client
DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync();
// Initialize request argument(s)
AddSplitPointsRequest request = new AddSplitPointsRequest
{
DatabaseAsDatabaseName = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]"),
SplitPoints = { new SplitPoints(), },
Initiator = "",
};
// Make the request
AddSplitPointsResponse response = await databaseAdminClient.AddSplitPointsAsync(request);
}
}
// [END spanner_v1_generated_DatabaseAdmin_AddSplitPoints_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_AddSplitPoints_sync]
using Google.Cloud.Spanner.Admin.Database.V1;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for AddSplitPoints</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void AddSplitPointsRequestObject()
{
// Create client
DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.Create();
// Initialize request argument(s)
AddSplitPointsRequest request = new AddSplitPointsRequest
{
DatabaseAsDatabaseName = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]"),
SplitPoints = { new SplitPoints(), },
Initiator = "",
};
// Make the request
AddSplitPointsResponse response = databaseAdminClient.AddSplitPoints(request);
}
}
// [END spanner_v1_generated_DatabaseAdmin_AddSplitPoints_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_AddSplitPoints_async_flattened_resourceNames]
using Google.Cloud.Spanner.Admin.Database.V1;
using System.Collections.Generic;
using System.Threading.Tasks;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for AddSplitPointsAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task AddSplitPointsResourceNamesAsync()
{
// Create client
DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync();
// Initialize request argument(s)
DatabaseName database = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]");
IEnumerable<SplitPoints> splitPoints = new SplitPoints[] { new SplitPoints(), };
// Make the request
AddSplitPointsResponse response = await databaseAdminClient.AddSplitPointsAsync(database, splitPoints);
}
}
// [END spanner_v1_generated_DatabaseAdmin_AddSplitPoints_async_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_AddSplitPoints_sync_flattened_resourceNames]
using Google.Cloud.Spanner.Admin.Database.V1;
using System.Collections.Generic;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for AddSplitPoints</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void AddSplitPointsResourceNames()
{
// Create client
DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.Create();
// Initialize request argument(s)
DatabaseName database = DatabaseName.FromProjectInstanceDatabase("[PROJECT]", "[INSTANCE]", "[DATABASE]");
IEnumerable<SplitPoints> splitPoints = new SplitPoints[] { new SplitPoints(), };
// Make the request
AddSplitPointsResponse response = databaseAdminClient.AddSplitPoints(database, splitPoints);
}
}
// [END spanner_v1_generated_DatabaseAdmin_AddSplitPoints_sync_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_AddSplitPoints_sync_flattened]
using Google.Cloud.Spanner.Admin.Database.V1;
using System.Collections.Generic;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for AddSplitPoints</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void AddSplitPoints()
{
// Create client
DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.Create();
// Initialize request argument(s)
string database = "projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]";
IEnumerable<SplitPoints> splitPoints = new SplitPoints[] { new SplitPoints(), };
// Make the request
AddSplitPointsResponse response = databaseAdminClient.AddSplitPoints(database, splitPoints);
}
}
// [END spanner_v1_generated_DatabaseAdmin_AddSplitPoints_sync_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2025 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
//
// https://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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START spanner_v1_generated_DatabaseAdmin_CopyBackup_async_flattened]
using Google.Cloud.Spanner.Admin.Database.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;
using System.Threading.Tasks;

public sealed partial class GeneratedDatabaseAdminClientSnippets
{
/// <summary>Snippet for CopyBackupAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CopyBackupAsync()
{
// Create client
DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/instances/[INSTANCE]";
string backupId = "";
string sourceBackup = "projects/[PROJECT]/instances/[INSTANCE]/backups/[BACKUP]";
Timestamp expireTime = new Timestamp();
// Make the request
Operation<Backup, CopyBackupMetadata> response = await databaseAdminClient.CopyBackupAsync(parent, backupId, sourceBackup, expireTime);

// Poll until the returned long-running operation is complete
Operation<Backup, CopyBackupMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Backup result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Backup, CopyBackupMetadata> retrievedResponse = await databaseAdminClient.PollOnceCopyBackupAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Backup retrievedResult = retrievedResponse.Result;
}
}
}
// [END spanner_v1_generated_DatabaseAdmin_CopyBackup_async_flattened]
}
Loading

0 comments on commit 94b0df7

Please sign in to comment.