Skip to content

Commit

Permalink
feat: added ApplySoftwareUpdate API docs: various clarifications, new…
Browse files Browse the repository at this point in the history
… documentation for ApplySoftwareUpdate chore: update proto annotations

PiperOrigin-RevId: 356380191

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Feb 8 16:30:59 2021 -0800
Source-Repo: googleapis/googleapis
Source-Sha: 84cf54e45ed5970980ae868e0a1e5ad1266a8830
Source-Link: googleapis/googleapis@84cf54e
  • Loading branch information
yoshi-automation authored and jskeet committed Feb 9, 2021
1 parent c0943b2 commit e02c6fd
Show file tree
Hide file tree
Showing 7 changed files with 1,345 additions and 284 deletions.
Expand Up @@ -920,7 +920,10 @@ public void DeleteInstanceRequestObject()
// Create client
CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.Create();
// Initialize request argument(s)
DeleteInstanceRequest request = new DeleteInstanceRequest { Name = "", };
DeleteInstanceRequest request = new DeleteInstanceRequest
{
InstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
};
// Make the request
Operation<Empty, OperationMetadata> response = cloudMemcacheClient.DeleteInstance(request);

Expand Down Expand Up @@ -950,7 +953,10 @@ public async Task DeleteInstanceRequestObjectAsync()
// Create client
CloudMemcacheClient cloudMemcacheClient = await CloudMemcacheClient.CreateAsync();
// Initialize request argument(s)
DeleteInstanceRequest request = new DeleteInstanceRequest { Name = "", };
DeleteInstanceRequest request = new DeleteInstanceRequest
{
InstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
};
// Make the request
Operation<Empty, OperationMetadata> response = await cloudMemcacheClient.DeleteInstanceAsync(request);

Expand Down Expand Up @@ -979,7 +985,7 @@ public void DeleteInstance()
// Create client
CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.Create();
// Initialize request argument(s)
string name = "";
string name = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
// Make the request
Operation<Empty, OperationMetadata> response = cloudMemcacheClient.DeleteInstance(name);

Expand Down Expand Up @@ -1009,7 +1015,66 @@ public async Task DeleteInstanceAsync()
// Create client
CloudMemcacheClient cloudMemcacheClient = await CloudMemcacheClient.CreateAsync();
// Initialize request argument(s)
string name = "";
string name = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
// Make the request
Operation<Empty, OperationMetadata> response = await cloudMemcacheClient.DeleteInstanceAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty 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<Empty, OperationMetadata> retrievedResponse = await cloudMemcacheClient.PollOnceDeleteInstanceAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
// End snippet
}

/// <summary>Snippet for DeleteInstance</summary>
public void DeleteInstanceResourceNames()
{
// Snippet: DeleteInstance(InstanceName, CallSettings)
// Create client
CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.Create();
// Initialize request argument(s)
InstanceName name = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
// Make the request
Operation<Empty, OperationMetadata> response = cloudMemcacheClient.DeleteInstance(name);

// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty 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<Empty, OperationMetadata> retrievedResponse = cloudMemcacheClient.PollOnceDeleteInstance(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
// End snippet
}

/// <summary>Snippet for DeleteInstanceAsync</summary>
public async Task DeleteInstanceResourceNamesAsync()
{
// Snippet: DeleteInstanceAsync(InstanceName, CallSettings)
// Additional: DeleteInstanceAsync(InstanceName, CancellationToken)
// Create client
CloudMemcacheClient cloudMemcacheClient = await CloudMemcacheClient.CreateAsync();
// Initialize request argument(s)
InstanceName name = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
// Make the request
Operation<Empty, OperationMetadata> response = await cloudMemcacheClient.DeleteInstanceAsync(name);

Expand Down Expand Up @@ -1225,5 +1290,200 @@ public async Task ApplyParametersResourceNamesAsync()
}
// End snippet
}

/// <summary>Snippet for ApplySoftwareUpdate</summary>
public void ApplySoftwareUpdateRequestObject()
{
// Snippet: ApplySoftwareUpdate(ApplySoftwareUpdateRequest, CallSettings)
// Create client
CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.Create();
// Initialize request argument(s)
ApplySoftwareUpdateRequest request = new ApplySoftwareUpdateRequest
{
InstanceAsInstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
NodeIds = { "", },
ApplyAll = false,
};
// Make the request
Operation<Instance, OperationMetadata> response = cloudMemcacheClient.ApplySoftwareUpdate(request);

// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadata> completedResponse = response.PollUntilCompleted();
// 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, OperationMetadata> retrievedResponse = cloudMemcacheClient.PollOnceApplySoftwareUpdate(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 snippet
}

/// <summary>Snippet for ApplySoftwareUpdateAsync</summary>
public async Task ApplySoftwareUpdateRequestObjectAsync()
{
// Snippet: ApplySoftwareUpdateAsync(ApplySoftwareUpdateRequest, CallSettings)
// Additional: ApplySoftwareUpdateAsync(ApplySoftwareUpdateRequest, CancellationToken)
// Create client
CloudMemcacheClient cloudMemcacheClient = await CloudMemcacheClient.CreateAsync();
// Initialize request argument(s)
ApplySoftwareUpdateRequest request = new ApplySoftwareUpdateRequest
{
InstanceAsInstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
NodeIds = { "", },
ApplyAll = false,
};
// Make the request
Operation<Instance, OperationMetadata> response = await cloudMemcacheClient.ApplySoftwareUpdateAsync(request);

// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadata> 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, OperationMetadata> retrievedResponse = await cloudMemcacheClient.PollOnceApplySoftwareUpdateAsync(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 snippet
}

/// <summary>Snippet for ApplySoftwareUpdate</summary>
public void ApplySoftwareUpdate()
{
// Snippet: ApplySoftwareUpdate(string, IEnumerable<string>, bool, CallSettings)
// Create client
CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.Create();
// Initialize request argument(s)
string instance = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
IEnumerable<string> nodeIds = new string[] { "", };
bool applyAll = false;
// Make the request
Operation<Instance, OperationMetadata> response = cloudMemcacheClient.ApplySoftwareUpdate(instance, nodeIds, applyAll);

// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadata> completedResponse = response.PollUntilCompleted();
// 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, OperationMetadata> retrievedResponse = cloudMemcacheClient.PollOnceApplySoftwareUpdate(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 snippet
}

/// <summary>Snippet for ApplySoftwareUpdateAsync</summary>
public async Task ApplySoftwareUpdateAsync()
{
// Snippet: ApplySoftwareUpdateAsync(string, IEnumerable<string>, bool, CallSettings)
// Additional: ApplySoftwareUpdateAsync(string, IEnumerable<string>, bool, CancellationToken)
// Create client
CloudMemcacheClient cloudMemcacheClient = await CloudMemcacheClient.CreateAsync();
// Initialize request argument(s)
string instance = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
IEnumerable<string> nodeIds = new string[] { "", };
bool applyAll = false;
// Make the request
Operation<Instance, OperationMetadata> response = await cloudMemcacheClient.ApplySoftwareUpdateAsync(instance, nodeIds, applyAll);

// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadata> 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, OperationMetadata> retrievedResponse = await cloudMemcacheClient.PollOnceApplySoftwareUpdateAsync(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 snippet
}

/// <summary>Snippet for ApplySoftwareUpdate</summary>
public void ApplySoftwareUpdateResourceNames()
{
// Snippet: ApplySoftwareUpdate(InstanceName, IEnumerable<string>, bool, CallSettings)
// Create client
CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.Create();
// Initialize request argument(s)
InstanceName instance = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
IEnumerable<string> nodeIds = new string[] { "", };
bool applyAll = false;
// Make the request
Operation<Instance, OperationMetadata> response = cloudMemcacheClient.ApplySoftwareUpdate(instance, nodeIds, applyAll);

// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadata> completedResponse = response.PollUntilCompleted();
// 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, OperationMetadata> retrievedResponse = cloudMemcacheClient.PollOnceApplySoftwareUpdate(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 snippet
}

/// <summary>Snippet for ApplySoftwareUpdateAsync</summary>
public async Task ApplySoftwareUpdateResourceNamesAsync()
{
// Snippet: ApplySoftwareUpdateAsync(InstanceName, IEnumerable<string>, bool, CallSettings)
// Additional: ApplySoftwareUpdateAsync(InstanceName, IEnumerable<string>, bool, CancellationToken)
// Create client
CloudMemcacheClient cloudMemcacheClient = await CloudMemcacheClient.CreateAsync();
// Initialize request argument(s)
InstanceName instance = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
IEnumerable<string> nodeIds = new string[] { "", };
bool applyAll = false;
// Make the request
Operation<Instance, OperationMetadata> response = await cloudMemcacheClient.ApplySoftwareUpdateAsync(instance, nodeIds, applyAll);

// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadata> 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, OperationMetadata> retrievedResponse = await cloudMemcacheClient.PollOnceApplySoftwareUpdateAsync(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 snippet
}
}
}
Expand Up @@ -67,6 +67,7 @@ public void GetInstanceRequestObject()
new Instance.Types.InstanceMessage(),
},
DiscoveryEndpoint = "discovery_endpointe07f14c7",
UpdateAvailable = true,
};
mockGrpcClient.Setup(x => x.GetInstance(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
CloudMemcacheClient client = new CloudMemcacheClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -114,6 +115,7 @@ public void GetInstanceRequestObject()
new Instance.Types.InstanceMessage(),
},
DiscoveryEndpoint = "discovery_endpointe07f14c7",
UpdateAvailable = true,
};
mockGrpcClient.Setup(x => x.GetInstanceAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Instance>(stt::Task.FromResult(expectedResponse), null, null, null, null));
CloudMemcacheClient client = new CloudMemcacheClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -163,6 +165,7 @@ public void GetInstance()
new Instance.Types.InstanceMessage(),
},
DiscoveryEndpoint = "discovery_endpointe07f14c7",
UpdateAvailable = true,
};
mockGrpcClient.Setup(x => x.GetInstance(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
CloudMemcacheClient client = new CloudMemcacheClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -210,6 +213,7 @@ public void GetInstance()
new Instance.Types.InstanceMessage(),
},
DiscoveryEndpoint = "discovery_endpointe07f14c7",
UpdateAvailable = true,
};
mockGrpcClient.Setup(x => x.GetInstanceAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Instance>(stt::Task.FromResult(expectedResponse), null, null, null, null));
CloudMemcacheClient client = new CloudMemcacheClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -259,6 +263,7 @@ public void GetInstanceResourceNames()
new Instance.Types.InstanceMessage(),
},
DiscoveryEndpoint = "discovery_endpointe07f14c7",
UpdateAvailable = true,
};
mockGrpcClient.Setup(x => x.GetInstance(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
CloudMemcacheClient client = new CloudMemcacheClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -306,6 +311,7 @@ public void GetInstanceResourceNames()
new Instance.Types.InstanceMessage(),
},
DiscoveryEndpoint = "discovery_endpointe07f14c7",
UpdateAvailable = true,
};
mockGrpcClient.Setup(x => x.GetInstanceAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Instance>(stt::Task.FromResult(expectedResponse), null, null, null, null));
CloudMemcacheClient client = new CloudMemcacheClientImpl(mockGrpcClient.Object, null);
Expand Down

0 comments on commit e02c6fd

Please sign in to comment.