/// <summary>Snippet for FailoverInstance</summary> public void FailoverInstance() { // Snippet: FailoverInstance(InstanceName,FailoverInstanceRequest.Types.DataProtectionMode,CallSettings) // Create client CloudRedisClient cloudRedisClient = CloudRedisClient.Create(); // Initialize request argument(s) InstanceName name = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]"); FailoverInstanceRequest.Types.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.Types.DataProtectionMode.Unspecified; // Make the request Operation <Instance, OperationMetadata> response = cloudRedisClient.FailoverInstance(name, dataProtectionMode); // 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.PollOnceFailoverInstance(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> /// Initiates a failover of the master node to current replica node for a /// specific STANDARD tier Cloud Memorystore for Redis instance. /// </summary> /// <param name="name"> /// Required. Redis instance resource name using the form: /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}` /// where `location_id` refers to a GCP region. /// </param> /// <param name="dataProtectionMode"> /// Optional. Available data protection modes that the user can choose. If it's /// unspecified, data protection mode will be LIMITED_DATA_LOSS by default. /// </param> /// <param name="cancellationToken"> /// A <see cref="st::CancellationToken"/> to use for this RPC. /// </param> /// <returns> /// A Task containing the RPC response. /// </returns> public virtual stt::Task <lro::Operation <Instance, pbwkt::Any> > FailoverInstanceAsync( string name, FailoverInstanceRequest.Types.DataProtectionMode dataProtectionMode, st::CancellationToken cancellationToken) => FailoverInstanceAsync( name, dataProtectionMode, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Initiates a failover of the master node to current replica node for a /// specific STANDARD tier Cloud Memorystore for Redis instance. /// </summary> /// <param name="name"> /// Required. Redis instance resource name using the form: /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}` /// where `location_id` refers to a GCP region. /// </param> /// <param name="dataProtectionMode"> /// Optional. Available data protection modes that the user can choose. If it's /// unspecified, data protection mode will be LIMITED_DATA_LOSS by default. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public virtual lro::Operation <Instance, OperationMetadata> FailoverInstance( InstanceName name, FailoverInstanceRequest.Types.DataProtectionMode dataProtectionMode, gaxgrpc::CallSettings callSettings = null) => FailoverInstance( new FailoverInstanceRequest { InstanceName = gax::GaxPreconditions.CheckNotNull(name, nameof(name)), DataProtectionMode = dataProtectionMode, }, callSettings);
/// <summary> /// Initiates a failover of the master node to current replica node for a /// specific STANDARD tier Cloud Memorystore for Redis instance. /// </summary> /// <param name="name"> /// Required. Redis instance resource name using the form: /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}` /// where `location_id` refers to a GCP region. /// </param> /// <param name="dataProtectionMode"> /// Optional. Available data protection modes that the user can choose. If it's /// unspecified, data protection mode will be LIMITED_DATA_LOSS by default. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// A Task containing the RPC response. /// </returns> public virtual stt::Task <lro::Operation <Instance, pbwkt::Any> > FailoverInstanceAsync( string name, FailoverInstanceRequest.Types.DataProtectionMode dataProtectionMode, gaxgrpc::CallSettings callSettings = null) => FailoverInstanceAsync( new FailoverInstanceRequest { Name = gax::GaxPreconditions.CheckNotNullOrEmpty(name, nameof(name)), DataProtectionMode = dataProtectionMode, }, callSettings);
/// <summary>Snippet for FailoverInstanceAsync</summary> public async Task FailoverInstanceAsync() { // Snippet: FailoverInstanceAsync(string,FailoverInstanceRequest.Types.DataProtectionMode,CallSettings) // Additional: FailoverInstanceAsync(string,FailoverInstanceRequest.Types.DataProtectionMode,CancellationToken) // Create client CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync(); // Initialize request argument(s) string formattedName = new InstanceName("[PROJECT]", "[LOCATION]", "[INSTANCE]").ToString(); FailoverInstanceRequest.Types.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.Types.DataProtectionMode.Unspecified; // Make the request Operation <Instance, Any> response = await cloudRedisClient.FailoverInstanceAsync(formattedName, dataProtectionMode); // Poll until the returned long-running operation is complete Operation <Instance, Any> 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, Any> retrievedResponse = await cloudRedisClient.PollOnceFailoverInstanceAsync(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 }