public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudWatch.Model.DeleteAlarmsRequest(); if (cmdletContext.AlarmName != null) { request.AlarmNames = cmdletContext.AlarmName; } 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> /// <para> Deletes all specified alarms. In the event of an error, no /// alarms are deleted. </para> /// </summary> /// /// <param name="deleteAlarmsRequest">Container for the necessary /// parameters to execute the DeleteAlarms service method on /// AmazonCloudWatch.</param> /// /// <exception cref="ResourceNotFoundException"/> public DeleteAlarmsResponse DeleteAlarms(DeleteAlarmsRequest deleteAlarmsRequest) { IRequest<DeleteAlarmsRequest> request = new DeleteAlarmsRequestMarshaller().Marshall(deleteAlarmsRequest); DeleteAlarmsResponse response = Invoke<DeleteAlarmsRequest, DeleteAlarmsResponse> (request, this.signer, DeleteAlarmsResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the DeleteAlarms operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteAlarms operation on AmazonCloudWatchClient.</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 EndDeleteAlarms /// operation.</returns> public IAsyncResult BeginDeleteAlarms(DeleteAlarmsRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteAlarmsRequestMarshaller(); var unmarshaller = DeleteAlarmsResponseUnmarshaller.Instance; return BeginInvoke<DeleteAlarmsRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Deletes all specified alarms. In the event of an error, no alarms are deleted. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteAlarms service method.</param> /// /// <returns>The response from the DeleteAlarms service method, as returned by CloudWatch.</returns> /// <exception cref="Amazon.CloudWatch.Model.ResourceNotFoundException"> /// The named resource does not exist. /// </exception> public DeleteAlarmsResponse DeleteAlarms(DeleteAlarmsRequest request) { var marshaller = new DeleteAlarmsRequestMarshaller(); var unmarshaller = DeleteAlarmsResponseUnmarshaller.Instance; return Invoke<DeleteAlarmsRequest,DeleteAlarmsResponse>(request, marshaller, unmarshaller); }
private Amazon.CloudWatch.Model.DeleteAlarmsResponse CallAWSServiceOperation(IAmazonCloudWatch client, Amazon.CloudWatch.Model.DeleteAlarmsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch", "DeleteAlarms"); try { #if DESKTOP return(client.DeleteAlarms(request)); #elif CORECLR return(client.DeleteAlarmsAsync(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; } }
internal DeleteAlarmsResponse DeleteAlarms(DeleteAlarmsRequest request) { var task = DeleteAlarmsAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para> Deletes all specified alarms. In the event of an error, no alarms are deleted. </para> /// </summary> /// /// <param name="deleteAlarmsRequest">Container for the necessary parameters to execute the DeleteAlarms service method on /// AmazonCloudWatch.</param> /// /// <exception cref="T:Amazon.CloudWatch.Model.ResourceNotFoundException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<DeleteAlarmsResponse> DeleteAlarmsAsync(DeleteAlarmsRequest deleteAlarmsRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteAlarmsRequestMarshaller(); var unmarshaller = DeleteAlarmsResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteAlarmsRequest, DeleteAlarmsResponse>(deleteAlarmsRequest, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para> Retrieves history for the specified alarm. Filter alarms by date range or item type. If an alarm name is not specified, Amazon /// CloudWatch returns histories for all of the owner's alarms. </para> <para><b>NOTE:</b> Amazon CloudWatch retains the history of an alarm for /// two weeks, whether or not you delete the alarm. </para> /// </summary>
/// <summary> /// <para> Deletes all specified alarms. In the event of an error, no alarms are deleted. </para> /// </summary> /// /// <param name="deleteAlarmsRequest">Container for the necessary parameters to execute the DeleteAlarms service method on /// AmazonCloudWatch.</param> /// /// <exception cref="T:Amazon.CloudWatch.Model.ResourceNotFoundException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<DeleteAlarmsResponse> DeleteAlarmsAsync(DeleteAlarmsRequest deleteAlarmsRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteAlarmsRequestMarshaller(); var unmarshaller = DeleteAlarmsResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DeleteAlarmsRequest, DeleteAlarmsResponse>(deleteAlarmsRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; } /// <summary> /// <para> Returns a list of valid metrics stored for the AWS account owner. Returned metrics can be used with GetMetricStatistics to obtain /// statistical data for a given metric. </para> <para><b>NOTE:</b> Up to 500 results are returned for any one call. To retrieve further /// results, use returned NextToken values with subsequent ListMetrics operations. </para> <para><b>NOTE:</b> If you create a metric with the /// PutMetricData action, allow up to fifteen minutes for the metric to appear in calls to the ListMetrics action. Statistics about the metric, /// however, are available sooner using GetMetricStatistics. </para>
public PutMetricAlarmResponse PutMetricAlarm(PutMetricAlarmRequest putMetricAlarmRequest) { IAsyncResult asyncResult = invokePutMetricAlarm(putMetricAlarmRequest, null, null, true); return EndPutMetricAlarm(asyncResult); } /// <summary> /// Initiates the asynchronous execution of the PutMetricAlarm operation. /// <seealso cref="Amazon.CloudWatch.AmazonCloudWatch.PutMetricAlarm"/> /// </summary> ///
internal DeleteAlarmsResponse DeleteAlarms(DeleteAlarmsRequest request) { var task = DeleteAlarmsAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the DeleteAlarms operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteAlarms 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<DeleteAlarmsResponse> DeleteAlarmsAsync(DeleteAlarmsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteAlarmsRequestMarshaller(); var unmarshaller = DeleteAlarmsResponseUnmarshaller.Instance; return InvokeAsync<DeleteAlarmsRequest,DeleteAlarmsResponse>(request, marshaller, unmarshaller, cancellationToken); }
public static void CWDeleteAlarms() { #region CWDeleteAlarms var client = new AmazonCloudWatchClient(); var request = new DeleteAlarmsRequest { AlarmNames = new List<string>() { "t1.microCPUUtilization" } }; client.DeleteAlarms(request); #endregion }