Skip to content

Commit

Permalink
feat(spanner): Add support for Cloud Spanner Default Backup Schedules
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688946300

Source-Link: googleapis/googleapis@b11e6b0

Source-Link: googleapis/googleapis-gen@f93f56b
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuU3Bhbm5lci5BZG1pbi5JbnN0YW5jZS5WMS8uT3dsQm90LnlhbWwiLCJoIjoiZjkzZjU2YjIxZmYwMWU0OTk5NzdjNGRkNTQ2ODljY2UxYjdjZjUzMCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Oct 23, 2024
1 parent a759d3c commit 9420b47
Show file tree
Hide file tree
Showing 129 changed files with 42,852 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../Google.Cloud.Spanner.Admin.Instance.V1/Google.Cloud.Spanner.Admin.Instance.V1.csproj" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2024 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_InstanceAdmin_CreateInstance_async_flattened]
using Google.Cloud.Spanner.Admin.Instance.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedInstanceAdminClientSnippets
{
/// <summary>Snippet for CreateInstanceAsync</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 CreateInstanceAsync()
{
// Create client
InstanceAdminClient instanceAdminClient = await InstanceAdminClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
string instanceId = "";
Instance instance = new Instance();
// Make the request
Operation<Instance, CreateInstanceMetadata> response = await instanceAdminClient.CreateInstanceAsync(parent, instanceId, instance);

// Poll until the returned long-running operation is complete
Operation<Instance, CreateInstanceMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Instance 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<Instance, CreateInstanceMetadata> retrievedResponse = await instanceAdminClient.PollOnceCreateInstanceAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Instance retrievedResult = retrievedResponse.Result;
}
}
}
// [END spanner_v1_generated_InstanceAdmin_CreateInstance_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2024 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_InstanceAdmin_CreateInstanceConfig_async_flattened]
using Google.Cloud.Spanner.Admin.Instance.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedInstanceAdminClientSnippets
{
/// <summary>Snippet for CreateInstanceConfigAsync</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 CreateInstanceConfigAsync()
{
// Create client
InstanceAdminClient instanceAdminClient = await InstanceAdminClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
InstanceConfig instanceConfig = new InstanceConfig();
string instanceConfigId = "";
// Make the request
Operation<InstanceConfig, CreateInstanceConfigMetadata> response = await instanceAdminClient.CreateInstanceConfigAsync(parent, instanceConfig, instanceConfigId);

// Poll until the returned long-running operation is complete
Operation<InstanceConfig, CreateInstanceConfigMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
InstanceConfig 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<InstanceConfig, CreateInstanceConfigMetadata> retrievedResponse = await instanceAdminClient.PollOnceCreateInstanceConfigAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
InstanceConfig retrievedResult = retrievedResponse.Result;
}
}
}
// [END spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2024 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_InstanceAdmin_CreateInstanceConfig_async]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Spanner.Admin.Instance.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedInstanceAdminClientSnippets
{
/// <summary>Snippet for CreateInstanceConfigAsync</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 CreateInstanceConfigRequestObjectAsync()
{
// Create client
InstanceAdminClient instanceAdminClient = await InstanceAdminClient.CreateAsync();
// Initialize request argument(s)
CreateInstanceConfigRequest request = new CreateInstanceConfigRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
InstanceConfigId = "",
InstanceConfig = new InstanceConfig(),
ValidateOnly = false,
};
// Make the request
Operation<InstanceConfig, CreateInstanceConfigMetadata> response = await instanceAdminClient.CreateInstanceConfigAsync(request);

// Poll until the returned long-running operation is complete
Operation<InstanceConfig, CreateInstanceConfigMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
InstanceConfig 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<InstanceConfig, CreateInstanceConfigMetadata> retrievedResponse = await instanceAdminClient.PollOnceCreateInstanceConfigAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
InstanceConfig retrievedResult = retrievedResponse.Result;
}
}
}
// [END spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2024 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_InstanceAdmin_CreateInstanceConfig_sync]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Spanner.Admin.Instance.V1;
using Google.LongRunning;

public sealed partial class GeneratedInstanceAdminClientSnippets
{
/// <summary>Snippet for CreateInstanceConfig</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 CreateInstanceConfigRequestObject()
{
// Create client
InstanceAdminClient instanceAdminClient = InstanceAdminClient.Create();
// Initialize request argument(s)
CreateInstanceConfigRequest request = new CreateInstanceConfigRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
InstanceConfigId = "",
InstanceConfig = new InstanceConfig(),
ValidateOnly = false,
};
// Make the request
Operation<InstanceConfig, CreateInstanceConfigMetadata> response = instanceAdminClient.CreateInstanceConfig(request);

// Poll until the returned long-running operation is complete
Operation<InstanceConfig, CreateInstanceConfigMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
InstanceConfig 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<InstanceConfig, CreateInstanceConfigMetadata> retrievedResponse = instanceAdminClient.PollOnceCreateInstanceConfig(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
InstanceConfig retrievedResult = retrievedResponse.Result;
}
}
}
// [END spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2024 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_InstanceAdmin_CreateInstanceConfig_async_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Spanner.Admin.Instance.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedInstanceAdminClientSnippets
{
/// <summary>Snippet for CreateInstanceConfigAsync</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 CreateInstanceConfigResourceNamesAsync()
{
// Create client
InstanceAdminClient instanceAdminClient = await InstanceAdminClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
InstanceConfig instanceConfig = new InstanceConfig();
string instanceConfigId = "";
// Make the request
Operation<InstanceConfig, CreateInstanceConfigMetadata> response = await instanceAdminClient.CreateInstanceConfigAsync(parent, instanceConfig, instanceConfigId);

// Poll until the returned long-running operation is complete
Operation<InstanceConfig, CreateInstanceConfigMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
InstanceConfig 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<InstanceConfig, CreateInstanceConfigMetadata> retrievedResponse = await instanceAdminClient.PollOnceCreateInstanceConfigAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
InstanceConfig retrievedResult = retrievedResponse.Result;
}
}
}
// [END spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_async_flattened_resourceNames]
}
Loading

0 comments on commit 9420b47

Please sign in to comment.