Promotes a read replica DB instance to a standalone DB instance.
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.RDS.Model.PromoteReadReplicaRequest(); if (cmdletContext.BackupRetentionPeriod != null) { request.BackupRetentionPeriod = cmdletContext.BackupRetentionPeriod.Value; } if (cmdletContext.DBInstanceIdentifier != null) { request.DBInstanceIdentifier = cmdletContext.DBInstanceIdentifier; } if (cmdletContext.PreferredBackupWindow != null) { request.PreferredBackupWindow = cmdletContext.PreferredBackupWindow; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
IAsyncResult invokePromoteReadReplica(PromoteReadReplicaRequest promoteReadReplicaRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new PromoteReadReplicaRequestMarshaller().Marshall(promoteReadReplicaRequest); var unmarshaller = PromoteReadReplicaResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> Promotes a Read Replica DB Instance to a standalone DB Instance. </para> /// </summary> /// /// <param name="promoteReadReplicaRequest">Container for the necessary parameters to execute the PromoteReadReplica service method on /// AmazonRDS.</param> /// /// <returns>The response from the PromoteReadReplica service method, as returned by AmazonRDS.</returns> /// /// <exception cref="DBInstanceNotFoundException"/> /// <exception cref="InvalidDBInstanceStateException"/> public PromoteReadReplicaResponse PromoteReadReplica(PromoteReadReplicaRequest promoteReadReplicaRequest) { IAsyncResult asyncResult = invokePromoteReadReplica(promoteReadReplicaRequest, null, null, true); return EndPromoteReadReplica(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the PromoteReadReplica operation. /// <seealso cref="Amazon.RDS.AmazonRDS.PromoteReadReplica"/> /// </summary> /// /// <param name="promoteReadReplicaRequest">Container for the necessary parameters to execute the PromoteReadReplica operation on /// AmazonRDS.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking /// EndPromoteReadReplica operation.</returns> public IAsyncResult BeginPromoteReadReplica(PromoteReadReplicaRequest promoteReadReplicaRequest, AsyncCallback callback, object state) { return invokePromoteReadReplica(promoteReadReplicaRequest, callback, state, false); }
/// <summary> /// Initiates the asynchronous execution of the PromoteReadReplica operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PromoteReadReplica operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<PromoteReadReplicaResponse> PromoteReadReplicaAsync(PromoteReadReplicaRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PromoteReadReplicaRequestMarshaller(); var unmarshaller = PromoteReadReplicaResponseUnmarshaller.Instance; return InvokeAsync<PromoteReadReplicaRequest,PromoteReadReplicaResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Promotes a Read Replica DB instance to a standalone DB instance. /// /// <note> /// <para> /// We recommend that you enable automated backups on your Read Replica before promoting /// the Read Replica. This ensures that no backup is taken during the promotion process. /// Once the instance is promoted to a primary instance, backups are taken based on your /// backup settings. /// </para> /// </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the PromoteReadReplica service method.</param> /// /// <returns>The response from the PromoteReadReplica service method, as returned by RDS.</returns> /// <exception cref="Amazon.RDS.Model.DBInstanceNotFoundException"> /// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance. /// </exception> /// <exception cref="Amazon.RDS.Model.InvalidDBInstanceStateException"> /// The specified DB instance is not in the <i>available</i> state. /// </exception> public PromoteReadReplicaResponse PromoteReadReplica(PromoteReadReplicaRequest request) { var marshaller = new PromoteReadReplicaRequestMarshaller(); var unmarshaller = PromoteReadReplicaResponseUnmarshaller.Instance; return Invoke<PromoteReadReplicaRequest,PromoteReadReplicaResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the PromoteReadReplica operation. /// <seealso cref="Amazon.RDS.IAmazonRDS.PromoteReadReplica"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PromoteReadReplica operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<PromoteReadReplicaResponse> PromoteReadReplicaAsync(PromoteReadReplicaRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PromoteReadReplicaRequestMarshaller(); var unmarshaller = PromoteReadReplicaResponseUnmarshaller.GetInstance(); return Invoke<IRequest, PromoteReadReplicaRequest, PromoteReadReplicaResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para> Promotes a read replica DB instance to a standalone DB instance. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PromoteReadReplica service method on /// AmazonRDS.</param> /// /// <returns>The response from the PromoteReadReplica service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBInstanceNotFoundException" /> /// <exception cref="T:Amazon.RDS.Model.InvalidDBInstanceStateException" /> public PromoteReadReplicaResponse PromoteReadReplica(PromoteReadReplicaRequest request) { var task = PromoteReadReplicaAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para> Promotes a read replica DB instance to a standalone DB instance. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PromoteReadReplica service method on /// AmazonRDS.</param> /// /// <returns>The response from the PromoteReadReplica service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBInstanceNotFoundException" /> /// <exception cref="T:Amazon.RDS.Model.InvalidDBInstanceStateException" /> public PromoteReadReplicaResponse PromoteReadReplica(PromoteReadReplicaRequest request) { var task = PromoteReadReplicaAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para> Promotes a read replica DB instance to a standalone DB instance. </para> /// </summary> /// /// <param name="promoteReadReplicaRequest">Container for the necessary parameters to execute the PromoteReadReplica service method on /// AmazonRDS.</param> /// /// <returns>The response from the PromoteReadReplica service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBInstanceNotFoundException" /> /// <exception cref="T:Amazon.RDS.Model.InvalidDBInstanceStateException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<PromoteReadReplicaResponse> PromoteReadReplicaAsync(PromoteReadReplicaRequest promoteReadReplicaRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PromoteReadReplicaRequestMarshaller(); var unmarshaller = PromoteReadReplicaResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, PromoteReadReplicaRequest, PromoteReadReplicaResponse>(promoteReadReplicaRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
private Amazon.RDS.Model.PromoteReadReplicaResponse CallAWSServiceOperation(IAmazonRDS client, Amazon.RDS.Model.PromoteReadReplicaRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Relational Database Service", "PromoteReadReplica"); try { #if DESKTOP return(client.PromoteReadReplica(request)); #elif CORECLR return(client.PromoteReadReplicaAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Initiates the asynchronous execution of the PromoteReadReplica operation. /// <seealso cref="Amazon.RDS.IAmazonRDS"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PromoteReadReplica operation on AmazonRDSClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPromoteReadReplica /// operation.</returns> public IAsyncResult BeginPromoteReadReplica(PromoteReadReplicaRequest request, AsyncCallback callback, object state) { var marshaller = new PromoteReadReplicaRequestMarshaller(); var unmarshaller = PromoteReadReplicaResponseUnmarshaller.Instance; return BeginInvoke<PromoteReadReplicaRequest>(request, marshaller, unmarshaller, callback, state); }