Skip to content

Commit

Permalink
redis: v1 add UpgradeInstance request
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 319332818

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jul 1 18:24:23 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 76905ffe7e3b0605f64ef889fb88913634f9f836
Source-Link: googleapis/googleapis@76905ff
  • Loading branch information
yoshi-automation authored and jskeet committed Jul 2, 2020
1 parent 518278e commit 0014243
Show file tree
Hide file tree
Showing 6 changed files with 785 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,195 @@ public async Task UpdateInstanceAsync()
// End snippet
}

/// <summary>Snippet for UpgradeInstance</summary>
public void UpgradeInstanceRequestObject()
{
// Snippet: UpgradeInstance(UpgradeInstanceRequest, CallSettings)
// Create client
CloudRedisClient cloudRedisClient = CloudRedisClient.Create();
// Initialize request argument(s)
UpgradeInstanceRequest request = new UpgradeInstanceRequest
{
InstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
RedisVersion = "",
};
// Make the request
Operation<Instance, OperationMetadata> response = cloudRedisClient.UpgradeInstance(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 = cloudRedisClient.PollOnceUpgradeInstance(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 UpgradeInstanceAsync</summary>
public async Task UpgradeInstanceRequestObjectAsync()
{
// Snippet: UpgradeInstanceAsync(UpgradeInstanceRequest, CallSettings)
// Additional: UpgradeInstanceAsync(UpgradeInstanceRequest, CancellationToken)
// Create client
CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();
// Initialize request argument(s)
UpgradeInstanceRequest request = new UpgradeInstanceRequest
{
InstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"),
RedisVersion = "",
};
// Make the request
Operation<Instance, OperationMetadata> response = await cloudRedisClient.UpgradeInstanceAsync(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 cloudRedisClient.PollOnceUpgradeInstanceAsync(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 UpgradeInstance</summary>
public void UpgradeInstance()
{
// Snippet: UpgradeInstance(string, string, CallSettings)
// Create client
CloudRedisClient cloudRedisClient = CloudRedisClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
string redisVersion = "";
// Make the request
Operation<Instance, OperationMetadata> response = cloudRedisClient.UpgradeInstance(name, redisVersion);

// 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 = cloudRedisClient.PollOnceUpgradeInstance(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 UpgradeInstanceAsync</summary>
public async Task UpgradeInstanceAsync()
{
// Snippet: UpgradeInstanceAsync(string, string, CallSettings)
// Additional: UpgradeInstanceAsync(string, string, CancellationToken)
// Create client
CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/instances/[INSTANCE]";
string redisVersion = "";
// Make the request
Operation<Instance, OperationMetadata> response = await cloudRedisClient.UpgradeInstanceAsync(name, redisVersion);

// 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 cloudRedisClient.PollOnceUpgradeInstanceAsync(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 UpgradeInstance</summary>
public void UpgradeInstanceResourceNames()
{
// Snippet: UpgradeInstance(InstanceName, string, CallSettings)
// Create client
CloudRedisClient cloudRedisClient = CloudRedisClient.Create();
// Initialize request argument(s)
InstanceName name = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
string redisVersion = "";
// Make the request
Operation<Instance, OperationMetadata> response = cloudRedisClient.UpgradeInstance(name, redisVersion);

// 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 = cloudRedisClient.PollOnceUpgradeInstance(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 UpgradeInstanceAsync</summary>
public async Task UpgradeInstanceResourceNamesAsync()
{
// Snippet: UpgradeInstanceAsync(InstanceName, string, CallSettings)
// Additional: UpgradeInstanceAsync(InstanceName, string, CancellationToken)
// Create client
CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync();
// Initialize request argument(s)
InstanceName name = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]");
string redisVersion = "";
// Make the request
Operation<Instance, OperationMetadata> response = await cloudRedisClient.UpgradeInstanceAsync(name, redisVersion);

// 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 cloudRedisClient.PollOnceUpgradeInstanceAsync(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 ImportInstance</summary>
public void ImportInstanceRequestObject()
{
Expand Down

0 comments on commit 0014243

Please sign in to comment.