public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.RDS.Model.CreateDBSnapshotRequest(); if (cmdletContext.DBInstanceIdentifier != null) { request.DBInstanceIdentifier = cmdletContext.DBInstanceIdentifier; } if (cmdletContext.DBSnapshotIdentifier != null) { request.DBSnapshotIdentifier = cmdletContext.DBSnapshotIdentifier; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSnapshot operation. /// <seealso cref="Amazon.RDS.AmazonRDS.CreateDBSnapshot"/> /// </summary> /// /// <param name="createDBSnapshotRequest">Container for the necessary parameters to execute the CreateDBSnapshot 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 EndCreateDBSnapshot /// operation.</returns> public IAsyncResult BeginCreateDBSnapshot(CreateDBSnapshotRequest createDBSnapshotRequest, AsyncCallback callback, object state) { return invokeCreateDBSnapshot(createDBSnapshotRequest, callback, state, false); }
IAsyncResult invokeCreateDBSnapshot(CreateDBSnapshotRequest createDBSnapshotRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateDBSnapshotRequestMarshaller().Marshall(createDBSnapshotRequest); var unmarshaller = CreateDBSnapshotResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> Creates a DBSnapshot. The source DBInstance must be in "available" state. </para> /// </summary> /// /// <param name="createDBSnapshotRequest">Container for the necessary parameters to execute the CreateDBSnapshot service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSnapshot service method, as returned by AmazonRDS.</returns> /// /// <exception cref="DBInstanceNotFoundException"/> /// <exception cref="InvalidDBInstanceStateException"/> /// <exception cref="SnapshotQuotaExceededException"/> /// <exception cref="DBSnapshotAlreadyExistsException"/> public CreateDBSnapshotResponse CreateDBSnapshot(CreateDBSnapshotRequest createDBSnapshotRequest) { IAsyncResult asyncResult = invokeCreateDBSnapshot(createDBSnapshotRequest, null, null, true); return EndCreateDBSnapshot(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSnapshot operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSnapshot 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<CreateDBSnapshotResponse> CreateDBSnapshotAsync(CreateDBSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDBSnapshotRequestMarshaller(); var unmarshaller = CreateDBSnapshotResponseUnmarshaller.Instance; return InvokeAsync<CreateDBSnapshotRequest,CreateDBSnapshotResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates a DBSnapshot. The source DBInstance must be in "available" state. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateDBSnapshot service method.</param> /// /// <returns>The response from the CreateDBSnapshot 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.DBSnapshotAlreadyExistsException"> /// <i>DBSnapshotIdentifier</i> is already used by an existing snapshot. /// </exception> /// <exception cref="Amazon.RDS.Model.InvalidDBInstanceStateException"> /// The specified DB instance is not in the <i>available</i> state. /// </exception> /// <exception cref="Amazon.RDS.Model.SnapshotQuotaExceededException"> /// Request would result in user exceeding the allowed number of DB snapshots. /// </exception> public CreateDBSnapshotResponse CreateDBSnapshot(CreateDBSnapshotRequest request) { var marshaller = new CreateDBSnapshotRequestMarshaller(); var unmarshaller = CreateDBSnapshotResponseUnmarshaller.Instance; return Invoke<CreateDBSnapshotRequest,CreateDBSnapshotResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSnapshot operation. /// <seealso cref="Amazon.RDS.IAmazonRDS.CreateDBSnapshot"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSnapshot 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<CreateDBSnapshotResponse> CreateDBSnapshotAsync(CreateDBSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDBSnapshotRequestMarshaller(); var unmarshaller = CreateDBSnapshotResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateDBSnapshotRequest, CreateDBSnapshotResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para> Creates a DBSnapshot. The source DBInstance must be in "available" state. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSnapshot service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSnapshot service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBInstanceNotFoundException" /> /// <exception cref="T:Amazon.RDS.Model.InvalidDBInstanceStateException" /> /// <exception cref="T:Amazon.RDS.Model.SnapshotQuotaExceededException" /> /// <exception cref="T:Amazon.RDS.Model.DBSnapshotAlreadyExistsException" /> public CreateDBSnapshotResponse CreateDBSnapshot(CreateDBSnapshotRequest request) { var task = CreateDBSnapshotAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para> Creates a DBSnapshot. The source DBInstance must be in "available" state. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSnapshot service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSnapshot service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBInstanceNotFoundException" /> /// <exception cref="T:Amazon.RDS.Model.InvalidDBInstanceStateException" /> /// <exception cref="T:Amazon.RDS.Model.SnapshotQuotaExceededException" /> /// <exception cref="T:Amazon.RDS.Model.DBSnapshotAlreadyExistsException" /> public CreateDBSnapshotResponse CreateDBSnapshot(CreateDBSnapshotRequest request) { var task = CreateDBSnapshotAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para> Creates a DBSnapshot. The source DBInstance must be in "available" state. </para> /// </summary> /// /// <param name="createDBSnapshotRequest">Container for the necessary parameters to execute the CreateDBSnapshot service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSnapshot service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBInstanceNotFoundException" /> /// <exception cref="T:Amazon.RDS.Model.InvalidDBInstanceStateException" /> /// <exception cref="T:Amazon.RDS.Model.SnapshotQuotaExceededException" /> /// <exception cref="T:Amazon.RDS.Model.DBSnapshotAlreadyExistsException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<CreateDBSnapshotResponse> CreateDBSnapshotAsync(CreateDBSnapshotRequest createDBSnapshotRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDBSnapshotRequestMarshaller(); var unmarshaller = CreateDBSnapshotResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateDBSnapshotRequest, CreateDBSnapshotResponse>(createDBSnapshotRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSnapshot operation. /// <seealso cref="Amazon.RDS.IAmazonRDS"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSnapshot 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 EndCreateDBSnapshot /// operation.</returns> public IAsyncResult BeginCreateDBSnapshot(CreateDBSnapshotRequest request, AsyncCallback callback, object state) { var marshaller = new CreateDBSnapshotRequestMarshaller(); var unmarshaller = CreateDBSnapshotResponseUnmarshaller.Instance; return BeginInvoke<CreateDBSnapshotRequest>(request, marshaller, unmarshaller, callback, state); }
private Amazon.RDS.Model.CreateDBSnapshotResponse CallAWSServiceOperation(IAmazonRDS client, Amazon.RDS.Model.CreateDBSnapshotRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Relational Database Service", "CreateDBSnapshot"); try { #if DESKTOP return(client.CreateDBSnapshot(request)); #elif CORECLR return(client.CreateDBSnapshotAsync(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> /// <para> Creates a DBSnapshot. The source DBInstance must be in "available" state. </para> /// </summary> /// /// <param name="createDBSnapshotRequest">Container for the necessary parameters to execute the CreateDBSnapshot service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSnapshot service method, as returned by AmazonRDS.</returns> /// /// <exception cref="DBInstanceNotFoundException"/> /// <exception cref="InvalidDBInstanceStateException"/> /// <exception cref="SnapshotQuotaExceededException"/> /// <exception cref="DBSnapshotAlreadyExistsException"/> public CreateDBSnapshotResponse CreateDBSnapshot(CreateDBSnapshotRequest createDBSnapshotRequest) { IRequest<CreateDBSnapshotRequest> request = new CreateDBSnapshotRequestMarshaller().Marshall(createDBSnapshotRequest); CreateDBSnapshotResponse response = Invoke<CreateDBSnapshotRequest, CreateDBSnapshotResponse> (request, this.signer, CreateDBSnapshotResponseUnmarshaller.GetInstance()); return response; }