Skip to content

Commit

Permalink
feat: updating the client to match the latest v1 API
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 517530755

Source-Link: googleapis/googleapis@4257751

Source-Link: googleapis/googleapis-gen@86f9ff4
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuRmlsZXN0b3JlLlYxLy5Pd2xCb3QueWFtbCIsImgiOiI4NmY5ZmY0ZTdjNzIxYzY4ODk3MzI3Y2JkYTk4NTY1OTY0YzIwN2FlIn0=
  • Loading branch information
gcf-owl-bot[bot] authored and jskeet committed Mar 18, 2023
1 parent c655f99 commit 6db60e7
Show file tree
Hide file tree
Showing 37 changed files with 8,622 additions and 565 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2023 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.Filestore.V1.Snippets
{
// [START file_v1_generated_CloudFilestoreManager_CreateSnapshot_async_flattened]
using Google.Cloud.Common;
using Google.Cloud.Filestore.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFilestoreManagerClientSnippets
{
/// <summary>Snippet for CreateSnapshotAsync</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 CreateSnapshotAsync()
{
// Create client
CloudFilestoreManagerClient cloudFilestoreManagerClient = await CloudFilestoreManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
Snapshot snapshot = new Snapshot();
string snapshotId = "";
// Make the request
Operation<Snapshot, OperationMetadata> response = await cloudFilestoreManagerClient.CreateSnapshotAsync(parent, snapshot, snapshotId);

// Poll until the returned long-running operation is complete
Operation<Snapshot, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Snapshot 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<Snapshot, OperationMetadata> retrievedResponse = await cloudFilestoreManagerClient.PollOnceCreateSnapshotAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Snapshot retrievedResult = retrievedResponse.Result;
}
}
}
// [END file_v1_generated_CloudFilestoreManager_CreateSnapshot_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2023 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.Filestore.V1.Snippets
{
// [START file_v1_generated_CloudFilestoreManager_CreateSnapshot_async]
using Google.Cloud.Common;
using Google.Cloud.Filestore.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFilestoreManagerClientSnippets
{
/// <summary>Snippet for CreateSnapshotAsync</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 CreateSnapshotRequestObjectAsync()
{
// Create client
CloudFilestoreManagerClient cloudFilestoreManagerClient = await CloudFilestoreManagerClient.CreateAsync();
// Initialize request argument(s)
CreateSnapshotRequest request = new CreateSnapshotRequest
{
ParentAsInstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
SnapshotId = "",
Snapshot = new Snapshot(),
};
// Make the request
Operation<Snapshot, OperationMetadata> response = await cloudFilestoreManagerClient.CreateSnapshotAsync(request);

// Poll until the returned long-running operation is complete
Operation<Snapshot, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Snapshot 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<Snapshot, OperationMetadata> retrievedResponse = await cloudFilestoreManagerClient.PollOnceCreateSnapshotAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Snapshot retrievedResult = retrievedResponse.Result;
}
}
}
// [END file_v1_generated_CloudFilestoreManager_CreateSnapshot_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2023 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.Filestore.V1.Snippets
{
// [START file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync]
using Google.Cloud.Common;
using Google.Cloud.Filestore.V1;
using Google.LongRunning;

public sealed partial class GeneratedCloudFilestoreManagerClientSnippets
{
/// <summary>Snippet for CreateSnapshot</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 CreateSnapshotRequestObject()
{
// Create client
CloudFilestoreManagerClient cloudFilestoreManagerClient = CloudFilestoreManagerClient.Create();
// Initialize request argument(s)
CreateSnapshotRequest request = new CreateSnapshotRequest
{
ParentAsInstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
SnapshotId = "",
Snapshot = new Snapshot(),
};
// Make the request
Operation<Snapshot, OperationMetadata> response = cloudFilestoreManagerClient.CreateSnapshot(request);

// Poll until the returned long-running operation is complete
Operation<Snapshot, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Snapshot 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<Snapshot, OperationMetadata> retrievedResponse = cloudFilestoreManagerClient.PollOnceCreateSnapshot(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Snapshot retrievedResult = retrievedResponse.Result;
}
}
}
// [END file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2023 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.Filestore.V1.Snippets
{
// [START file_v1_generated_CloudFilestoreManager_CreateSnapshot_async_flattened_resourceNames]
using Google.Cloud.Common;
using Google.Cloud.Filestore.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFilestoreManagerClientSnippets
{
/// <summary>Snippet for CreateSnapshotAsync</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 CreateSnapshotResourceNamesAsync()
{
// Create client
CloudFilestoreManagerClient cloudFilestoreManagerClient = await CloudFilestoreManagerClient.CreateAsync();
// Initialize request argument(s)
InstanceName parent = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
Snapshot snapshot = new Snapshot();
string snapshotId = "";
// Make the request
Operation<Snapshot, OperationMetadata> response = await cloudFilestoreManagerClient.CreateSnapshotAsync(parent, snapshot, snapshotId);

// Poll until the returned long-running operation is complete
Operation<Snapshot, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Snapshot 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<Snapshot, OperationMetadata> retrievedResponse = await cloudFilestoreManagerClient.PollOnceCreateSnapshotAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Snapshot retrievedResult = retrievedResponse.Result;
}
}
}
// [END file_v1_generated_CloudFilestoreManager_CreateSnapshot_async_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2023 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.Filestore.V1.Snippets
{
// [START file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync_flattened_resourceNames]
using Google.Cloud.Common;
using Google.Cloud.Filestore.V1;
using Google.LongRunning;

public sealed partial class GeneratedCloudFilestoreManagerClientSnippets
{
/// <summary>Snippet for CreateSnapshot</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 CreateSnapshotResourceNames()
{
// Create client
CloudFilestoreManagerClient cloudFilestoreManagerClient = CloudFilestoreManagerClient.Create();
// Initialize request argument(s)
InstanceName parent = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
Snapshot snapshot = new Snapshot();
string snapshotId = "";
// Make the request
Operation<Snapshot, OperationMetadata> response = cloudFilestoreManagerClient.CreateSnapshot(parent, snapshot, snapshotId);

// Poll until the returned long-running operation is complete
Operation<Snapshot, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Snapshot 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<Snapshot, OperationMetadata> retrievedResponse = cloudFilestoreManagerClient.PollOnceCreateSnapshot(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Snapshot retrievedResult = retrievedResponse.Result;
}
}
}
// [END file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2023 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.Filestore.V1.Snippets
{
// [START file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync_flattened]
using Google.Cloud.Common;
using Google.Cloud.Filestore.V1;
using Google.LongRunning;

public sealed partial class GeneratedCloudFilestoreManagerClientSnippets
{
/// <summary>Snippet for CreateSnapshot</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 CreateSnapshot()
{
// Create client
CloudFilestoreManagerClient cloudFilestoreManagerClient = CloudFilestoreManagerClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
Snapshot snapshot = new Snapshot();
string snapshotId = "";
// Make the request
Operation<Snapshot, OperationMetadata> response = cloudFilestoreManagerClient.CreateSnapshot(parent, snapshot, snapshotId);

// Poll until the returned long-running operation is complete
Operation<Snapshot, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Snapshot 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<Snapshot, OperationMetadata> retrievedResponse = cloudFilestoreManagerClient.PollOnceCreateSnapshot(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Snapshot retrievedResult = retrievedResponse.Result;
}
}
}
// [END file_v1_generated_CloudFilestoreManager_CreateSnapshot_sync_flattened]
}
Loading

0 comments on commit 6db60e7

Please sign in to comment.