Enables the automatic copy of snapshots from one region to another region for a specified cluster.
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Redshift.Model.EnableSnapshotCopyRequest(); if (cmdletContext.ClusterIdentifier != null) { request.ClusterIdentifier = cmdletContext.ClusterIdentifier; } if (cmdletContext.DestinationRegion != null) { request.DestinationRegion = cmdletContext.DestinationRegion; } if (cmdletContext.ManualSnapshotRetentionPeriod != null) { request.ManualSnapshotRetentionPeriod = cmdletContext.ManualSnapshotRetentionPeriod.Value; } if (cmdletContext.RetentionPeriod != null) { request.RetentionPeriod = cmdletContext.RetentionPeriod.Value; } if (cmdletContext.SnapshotCopyGrantName != null) { request.SnapshotCopyGrantName = cmdletContext.SnapshotCopyGrantName; } 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 invokeEnableSnapshotCopy(EnableSnapshotCopyRequest enableSnapshotCopyRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new EnableSnapshotCopyRequestMarshaller().Marshall(enableSnapshotCopyRequest); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the EnableSnapshotCopy operation. /// <seealso cref="Amazon.Redshift.IAmazonRedshift.EnableSnapshotCopy"/> /// </summary> /// /// <param name="enableSnapshotCopyRequest">Container for the necessary parameters to execute the EnableSnapshotCopy operation on /// AmazonRedshift.</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 /// EndEnableSnapshotCopy operation.</returns> public IAsyncResult BeginEnableSnapshotCopy(EnableSnapshotCopyRequest enableSnapshotCopyRequest, AsyncCallback callback, object state) { return invokeEnableSnapshotCopy(enableSnapshotCopyRequest, callback, state, false); }
/// <summary> /// <para>Enables the automatic copy of snapshots from one region to another region for a specified cluster.</para> /// </summary> /// /// <param name="enableSnapshotCopyRequest">Container for the necessary parameters to execute the EnableSnapshotCopy service method on /// AmazonRedshift.</param> /// /// <returns>The response from the EnableSnapshotCopy service method, as returned by AmazonRedshift.</returns> /// /// <exception cref="CopyToRegionDisabledException"/> /// <exception cref="UnauthorizedOperationException"/> /// <exception cref="InvalidClusterStateException"/> /// <exception cref="ClusterNotFoundException"/> /// <exception cref="IncompatibleOrderableOptionsException"/> /// <exception cref="SnapshotCopyAlreadyEnabledException"/> /// <exception cref="UnknownSnapshotCopyRegionException"/> public EnableSnapshotCopyResponse EnableSnapshotCopy(EnableSnapshotCopyRequest enableSnapshotCopyRequest) { IAsyncResult asyncResult = invokeEnableSnapshotCopy(enableSnapshotCopyRequest, null, null, true); return EndEnableSnapshotCopy(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the EnableSnapshotCopy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the EnableSnapshotCopy operation on AmazonRedshiftClient.</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 EndEnableSnapshotCopy /// operation.</returns> public IAsyncResult BeginEnableSnapshotCopy(EnableSnapshotCopyRequest request, AsyncCallback callback, object state) { var marshaller = new EnableSnapshotCopyRequestMarshaller(); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.Instance; return BeginInvoke<EnableSnapshotCopyRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Enables the automatic copy of snapshots from one region to another region for a specified /// cluster. /// </summary> /// <param name="request">Container for the necessary parameters to execute the EnableSnapshotCopy service method.</param> /// /// <returns>The response from the EnableSnapshotCopy service method, as returned by Redshift.</returns> /// <exception cref="Amazon.Redshift.Model.ClusterNotFoundException"> /// The <i>ClusterIdentifier</i> parameter does not refer to an existing cluster. /// </exception> /// <exception cref="Amazon.Redshift.Model.CopyToRegionDisabledException"> /// Cross-region snapshot copy was temporarily disabled. Try your request again. /// </exception> /// <exception cref="Amazon.Redshift.Model.IncompatibleOrderableOptionsException"> /// The specified options are incompatible. /// </exception> /// <exception cref="Amazon.Redshift.Model.InvalidClusterStateException"> /// The specified cluster is not in the <code>available</code> state. /// </exception> /// <exception cref="Amazon.Redshift.Model.LimitExceededException"> /// The encryption key has exceeded its grant limit in AWS KMS. /// </exception> /// <exception cref="Amazon.Redshift.Model.SnapshotCopyAlreadyEnabledException"> /// The cluster already has cross-region snapshot copy enabled. /// </exception> /// <exception cref="Amazon.Redshift.Model.SnapshotCopyGrantNotFoundException"> /// The specified snapshot copy grant can't be found. Make sure that the name is typed /// correctly and that the grant exists in the destination region. /// </exception> /// <exception cref="Amazon.Redshift.Model.UnauthorizedOperationException"> /// Your account is not authorized to perform the requested operation. /// </exception> /// <exception cref="Amazon.Redshift.Model.UnknownSnapshotCopyRegionException"> /// The specified region is incorrect or does not exist. /// </exception> public EnableSnapshotCopyResponse EnableSnapshotCopy(EnableSnapshotCopyRequest request) { var marshaller = new EnableSnapshotCopyRequestMarshaller(); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.Instance; return Invoke<EnableSnapshotCopyRequest,EnableSnapshotCopyResponse>(request, marshaller, unmarshaller); }
/// <summary> /// <para>Enables the automatic copy of snapshots from one region to another region for a specified cluster.</para> /// </summary> /// /// <param name="enableSnapshotCopyRequest">Container for the necessary parameters to execute the EnableSnapshotCopy service method on /// AmazonRedshift.</param> /// /// <returns>The response from the EnableSnapshotCopy service method, as returned by AmazonRedshift.</returns> /// /// <exception cref="T:Amazon.Redshift.Model.CopyToRegionDisabledException" /> /// <exception cref="T:Amazon.Redshift.Model.UnauthorizedOperationException" /> /// <exception cref="T:Amazon.Redshift.Model.InvalidClusterStateException" /> /// <exception cref="T:Amazon.Redshift.Model.ClusterNotFoundException" /> /// <exception cref="T:Amazon.Redshift.Model.IncompatibleOrderableOptionsException" /> /// <exception cref="T:Amazon.Redshift.Model.SnapshotCopyAlreadyEnabledException" /> /// <exception cref="T:Amazon.Redshift.Model.UnknownSnapshotCopyRegionException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<EnableSnapshotCopyResponse> EnableSnapshotCopyAsync(EnableSnapshotCopyRequest enableSnapshotCopyRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new EnableSnapshotCopyRequestMarshaller(); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.GetInstance(); return Invoke<IRequest, EnableSnapshotCopyRequest, EnableSnapshotCopyResponse>(enableSnapshotCopyRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal EnableSnapshotCopyResponse EnableSnapshotCopy(EnableSnapshotCopyRequest request) { var task = EnableSnapshotCopyAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para>Enables the automatic copy of snapshots from one region to another region for a specified cluster.</para> /// </summary> /// /// <param name="enableSnapshotCopyRequest">Container for the necessary parameters to execute the EnableSnapshotCopy service method on /// AmazonRedshift.</param> /// /// <returns>The response from the EnableSnapshotCopy service method, as returned by AmazonRedshift.</returns> /// /// <exception cref="T:Amazon.Redshift.Model.CopyToRegionDisabledException" /> /// <exception cref="T:Amazon.Redshift.Model.UnauthorizedOperationException" /> /// <exception cref="T:Amazon.Redshift.Model.InvalidClusterStateException" /> /// <exception cref="T:Amazon.Redshift.Model.ClusterNotFoundException" /> /// <exception cref="T:Amazon.Redshift.Model.IncompatibleOrderableOptionsException" /> /// <exception cref="T:Amazon.Redshift.Model.SnapshotCopyAlreadyEnabledException" /> /// <exception cref="T:Amazon.Redshift.Model.UnknownSnapshotCopyRegionException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<EnableSnapshotCopyResponse> EnableSnapshotCopyAsync(EnableSnapshotCopyRequest enableSnapshotCopyRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new EnableSnapshotCopyRequestMarshaller(); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, EnableSnapshotCopyRequest, EnableSnapshotCopyResponse>(enableSnapshotCopyRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
internal EnableSnapshotCopyResponse EnableSnapshotCopy(EnableSnapshotCopyRequest request) { var task = EnableSnapshotCopyAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the EnableSnapshotCopy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the EnableSnapshotCopy 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<EnableSnapshotCopyResponse> EnableSnapshotCopyAsync(EnableSnapshotCopyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new EnableSnapshotCopyRequestMarshaller(); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.Instance; return InvokeAsync<EnableSnapshotCopyRequest,EnableSnapshotCopyResponse>(request, marshaller, unmarshaller, cancellationToken); }
private Amazon.Redshift.Model.EnableSnapshotCopyResponse CallAWSServiceOperation(IAmazonRedshift client, Amazon.Redshift.Model.EnableSnapshotCopyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Redshift", "EnableSnapshotCopy"); try { #if DESKTOP return(client.EnableSnapshotCopy(request)); #elif CORECLR return(client.EnableSnapshotCopyAsync(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; } }
IAsyncResult invokeEnableSnapshotCopy(EnableSnapshotCopyRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new EnableSnapshotCopyRequestMarshaller(); var unmarshaller = EnableSnapshotCopyResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }