Skip to content

Commit

Permalink
feat: Add custom instance config operations
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 474535825

Source-Link: googleapis/googleapis@69c840e

Source-Link: googleapis/googleapis-gen@33e360e
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuU3Bhbm5lci5BZG1pbi5JbnN0YW5jZS5WMS8uT3dsQm90LnlhbWwiLCJoIjoiMzNlMzYwZTdkNGJmMjQ3OWZhNzllYWNlODUxNjY0NTNjZDc2MGIwZCJ9
  • Loading branch information
gcf-owl-bot[bot] authored and jskeet committed Sep 15, 2022
1 parent f64fcca commit 58cadb7
Show file tree
Hide file tree
Showing 32 changed files with 9,259 additions and 928 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// 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
//
// 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 Google.Cloud.Spanner.Admin.Instance.V1.Snippets
{
// [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 for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </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,65 @@
// 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
//
// 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 Google.Cloud.Spanner.Admin.Instance.V1.Snippets
{
// [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 for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </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,64 @@
// 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
//
// 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 Google.Cloud.Spanner.Admin.Instance.V1.Snippets
{
// [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 for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </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,61 @@
// 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
//
// 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 Google.Cloud.Spanner.Admin.Instance.V1.Snippets
{
// [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 for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </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]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// 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
//
// 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 Google.Cloud.Spanner.Admin.Instance.V1.Snippets
{
// [START spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_sync_flattened_resourceNames]
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 for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public void CreateInstanceConfigResourceNames()
{
// Create client
InstanceAdminClient instanceAdminClient = InstanceAdminClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
InstanceConfig instanceConfig = new InstanceConfig();
string instanceConfigId = "";
// Make the request
Operation<InstanceConfig, CreateInstanceConfigMetadata> response = instanceAdminClient.CreateInstanceConfig(parent, instanceConfig, instanceConfigId);

// 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_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// 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
//
// 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 Google.Cloud.Spanner.Admin.Instance.V1.Snippets
{
// [START spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_sync_flattened]
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 for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public void CreateInstanceConfig()
{
// Create client
InstanceAdminClient instanceAdminClient = InstanceAdminClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
InstanceConfig instanceConfig = new InstanceConfig();
string instanceConfigId = "";
// Make the request
Operation<InstanceConfig, CreateInstanceConfigMetadata> response = instanceAdminClient.CreateInstanceConfig(parent, instanceConfig, instanceConfigId);

// 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_flattened]
}
Loading

0 comments on commit 58cadb7

Please sign in to comment.