public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ElastiCache.Model.CreateSnapshotRequest(); if (cmdletContext.CacheClusterId != null) { request.CacheClusterId = cmdletContext.CacheClusterId; } if (cmdletContext.KmsKeyId != null) { request.KmsKeyId = cmdletContext.KmsKeyId; } if (cmdletContext.ReplicationGroupId != null) { request.ReplicationGroupId = cmdletContext.ReplicationGroupId; } if (cmdletContext.SnapshotName != null) { request.SnapshotName = cmdletContext.SnapshotName; } 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 CreateSnapshot operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateSnapshot 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<CreateSnapshotResponse> CreateSnapshotAsync(CreateSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateSnapshotRequestMarshaller(); var unmarshaller = CreateSnapshotResponseUnmarshaller.Instance; return InvokeAsync<CreateSnapshotRequest,CreateSnapshotResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// The <i>CreateSnapshot</i> operation creates a copy of an entire cache cluster at a /// specific moment in time. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateSnapshot service method.</param> /// /// <returns>The response from the CreateSnapshot service method, as returned by ElastiCache.</returns> /// <exception cref="Amazon.ElastiCache.Model.CacheClusterNotFoundException"> /// The requested cache cluster ID does not refer to an existing cache cluster. /// </exception> /// <exception cref="Amazon.ElastiCache.Model.InvalidCacheClusterStateException"> /// The requested cache cluster is not in the <i>available</i> state. /// </exception> /// <exception cref="Amazon.ElastiCache.Model.InvalidParameterCombinationException"> /// Two or more incompatible parameters were specified. /// </exception> /// <exception cref="Amazon.ElastiCache.Model.InvalidParameterValueException"> /// The value for a parameter is invalid. /// </exception> /// <exception cref="Amazon.ElastiCache.Model.SnapshotAlreadyExistsException"> /// You already have a snapshot with the given name. /// </exception> /// <exception cref="Amazon.ElastiCache.Model.SnapshotFeatureNotSupportedException"> /// You attempted one of the following actions: /// /// <ul> <li> /// <para> /// Creating a snapshot of a Redis cache cluster running on a <i>t1.micro</i> cache node. /// </para> /// </li> <li> /// <para> /// Creating a snapshot of a cache cluster that is running Memcached rather than Redis. /// </para> /// </li> </ul> /// <para> /// Neither of these are supported by ElastiCache. /// </para> /// </exception> /// <exception cref="Amazon.ElastiCache.Model.SnapshotQuotaExceededException"> /// The request cannot be processed because it would exceed the maximum number of snapshots. /// </exception> public CreateSnapshotResponse CreateSnapshot(CreateSnapshotRequest request) { var marshaller = new CreateSnapshotRequestMarshaller(); var unmarshaller = CreateSnapshotResponseUnmarshaller.Instance; return Invoke<CreateSnapshotRequest,CreateSnapshotResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateSnapshot operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateSnapshot operation on AmazonElastiCacheClient.</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 EndCreateSnapshot /// operation.</returns> public IAsyncResult BeginCreateSnapshot(CreateSnapshotRequest request, AsyncCallback callback, object state) { var marshaller = new CreateSnapshotRequestMarshaller(); var unmarshaller = CreateSnapshotResponseUnmarshaller.Instance; return BeginInvoke<CreateSnapshotRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the CreateSnapshot operation. /// <seealso cref="Amazon.ElastiCache.IAmazonElastiCache.CreateSnapshot"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateSnapshot 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<CreateSnapshotResponse> CreateSnapshotAsync(CreateSnapshotRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateSnapshotRequestMarshaller(); var unmarshaller = CreateSnapshotResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateSnapshotRequest, CreateSnapshotResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>The <i>CreateSnapshot</i> operation creates a copy of an entire cache cluster at a specific moment in time.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateSnapshot service method on /// AmazonElastiCache.</param> /// /// <returns>The response from the CreateSnapshot service method, as returned by AmazonElastiCache.</returns> /// /// <exception cref="T:Amazon.ElastiCache.Model.InvalidParameterValueException" /> /// <exception cref="T:Amazon.ElastiCache.Model.SnapshotFeatureNotSupportedException" /> /// <exception cref="T:Amazon.ElastiCache.Model.CacheClusterNotFoundException" /> /// <exception cref="T:Amazon.ElastiCache.Model.InvalidParameterCombinationException" /> /// <exception cref="T:Amazon.ElastiCache.Model.SnapshotAlreadyExistsException" /> /// <exception cref="T:Amazon.ElastiCache.Model.InvalidCacheClusterStateException" /> /// <exception cref="T:Amazon.ElastiCache.Model.SnapshotQuotaExceededException" /> public CreateSnapshotResponse CreateSnapshot(CreateSnapshotRequest request) { var task = CreateSnapshotAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.ElastiCache.Model.CreateSnapshotResponse CallAWSServiceOperation(IAmazonElastiCache client, Amazon.ElastiCache.Model.CreateSnapshotRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon ElastiCache", "CreateSnapshot"); try { #if DESKTOP return(client.CreateSnapshot(request)); #elif CORECLR return(client.CreateSnapshotAsync(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 invokeCreateSnapshot(CreateSnapshotRequest createSnapshotRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateSnapshotRequestMarshaller().Marshall(createSnapshotRequest); var unmarshaller = CreateSnapshotResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreateSnapshot operation. /// <seealso cref="Amazon.ElastiCache.IAmazonElastiCache.CreateSnapshot"/> /// </summary> /// /// <param name="createSnapshotRequest">Container for the necessary parameters to execute the CreateSnapshot operation on /// AmazonElastiCache.</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 EndCreateSnapshot /// operation.</returns> public IAsyncResult BeginCreateSnapshot(CreateSnapshotRequest createSnapshotRequest, AsyncCallback callback, object state) { return invokeCreateSnapshot(createSnapshotRequest, callback, state, false); }
/// <summary> /// <para>The <i>CreateSnapshot</i> operation creates a copy of an entire cache cluster at a specific moment in time.</para> /// </summary> /// /// <param name="createSnapshotRequest">Container for the necessary parameters to execute the CreateSnapshot service method on /// AmazonElastiCache.</param> /// /// <returns>The response from the CreateSnapshot service method, as returned by AmazonElastiCache.</returns> /// /// <exception cref="InvalidParameterValueException"/> /// <exception cref="SnapshotFeatureNotSupportedException"/> /// <exception cref="CacheClusterNotFoundException"/> /// <exception cref="InvalidParameterCombinationException"/> /// <exception cref="SnapshotAlreadyExistsException"/> /// <exception cref="InvalidCacheClusterStateException"/> /// <exception cref="SnapshotQuotaExceededException"/> public CreateSnapshotResponse CreateSnapshot(CreateSnapshotRequest createSnapshotRequest) { IAsyncResult asyncResult = invokeCreateSnapshot(createSnapshotRequest, null, null, true); return EndCreateSnapshot(asyncResult); }