/// <summary> /// Delete a specified report definition /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteReportDefinition service method.</param> /// /// <returns>The response from the DeleteReportDefinition service method, as returned by CostAndUsageReport.</returns> /// <exception cref="Amazon.CostAndUsageReport.Model.InternalErrorException"> /// This exception is thrown on a known dependency failure. /// </exception> /// <exception cref="Amazon.CostAndUsageReport.Model.ValidationException"> /// This exception is thrown when providing an invalid input. eg. Put a report preference /// with an invalid report name, or Delete a report preference with an empty report name. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition">REST API Reference for DeleteReportDefinition Operation</seealso> public DeleteReportDefinitionResponse DeleteReportDefinition(DeleteReportDefinitionRequest request) { var marshaller = new DeleteReportDefinitionRequestMarshaller(); var unmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return(Invoke <DeleteReportDefinitionRequest, DeleteReportDefinitionResponse>(request, marshaller, unmarshaller)); }
internal virtual DeleteReportDefinitionResponse DeleteReportDefinition(DeleteReportDefinitionRequest request) { var marshaller = DeleteReportDefinitionRequestMarshaller.Instance; var unmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return(Invoke <DeleteReportDefinitionRequest, DeleteReportDefinitionResponse>(request, marshaller, unmarshaller)); }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIDatasafeReportDefinition", "Remove")) { return; } DeleteReportDefinitionRequest request; try { request = new DeleteReportDefinitionRequest { ReportDefinitionId = ReportDefinitionId, IfMatch = IfMatch, OpcRequestId = OpcRequestId }; response = client.DeleteReportDefinition(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Initiates the asynchronous execution of the DeleteReportDefinition operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteReportDefinition 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition">REST API Reference for DeleteReportDefinition Operation</seealso> public Task <DeleteReportDefinitionResponse> DeleteReportDefinitionAsync(DeleteReportDefinitionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteReportDefinitionRequestMarshaller(); var unmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return(InvokeAsync <DeleteReportDefinitionRequest, DeleteReportDefinitionResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the DeleteReportDefinition operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteReportDefinition operation on AmazonCostAndUsageReportClient.</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 EndDeleteReportDefinition /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition">REST API Reference for DeleteReportDefinition Operation</seealso> public virtual IAsyncResult BeginDeleteReportDefinition(DeleteReportDefinitionRequest request, AsyncCallback callback, object state) { var marshaller = DeleteReportDefinitionRequestMarshaller.Instance; var unmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return(BeginInvoke <DeleteReportDefinitionRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Deletes the specified report. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteReportDefinition service method.</param> /// /// <returns>The response from the DeleteReportDefinition service method, as returned by CostAndUsageReport.</returns> /// <exception cref="Amazon.CostAndUsageReport.Model.InternalErrorException"> /// An error on the server occurred during the processing of your request. Try again later. /// </exception> /// <exception cref="Amazon.CostAndUsageReport.Model.ValidationException"> /// The input fails to satisfy the constraints specified by an AWS service. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition">REST API Reference for DeleteReportDefinition Operation</seealso> public virtual DeleteReportDefinitionResponse DeleteReportDefinition(DeleteReportDefinitionRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteReportDefinitionRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return Invoke<DeleteReportDefinitionResponse>(request, options); }
/// <summary> /// Initiates the asynchronous execution of the DeleteReportDefinition operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteReportDefinition operation on AmazonCostAndUsageReportClient.</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 EndDeleteReportDefinition /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition">REST API Reference for DeleteReportDefinition Operation</seealso> public virtual IAsyncResult BeginDeleteReportDefinition(DeleteReportDefinitionRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteReportDefinitionRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
/// <summary> /// Deletes the specified report. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteReportDefinition service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DeleteReportDefinition service method, as returned by CostAndUsageReport.</returns> /// <exception cref="Amazon.CostAndUsageReport.Model.InternalErrorException"> /// An error on the server occurred during the processing of your request. Try again later. /// </exception> /// <exception cref="Amazon.CostAndUsageReport.Model.ValidationException"> /// The input fails to satisfy the constraints specified by an AWS service. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition">REST API Reference for DeleteReportDefinition Operation</seealso> public virtual Task <DeleteReportDefinitionResponse> DeleteReportDefinitionAsync(DeleteReportDefinitionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteReportDefinitionRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteReportDefinitionResponseUnmarshaller.Instance; return(InvokeAsync <DeleteReportDefinitionResponse>(request, options, cancellationToken)); }
/// <summary> /// Deletes the specified report. /// DeleteReportDefinition /#X-Amz-Target=AWSOrigamiServiceGatewayService.DeleteReportDefinition /// </summary> /// <returns>Success</returns> public async Task <DeleteReportDefinitionResponse> DeleteReportDefinitionAsync(DeleteReportDefinitionRequest requestBody, Action <System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null) { var requestUri = "/#X-Amz-Target=AWSOrigamiServiceGatewayService.DeleteReportDefinition"; using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri)) { using (var requestWriter = new System.IO.StringWriter()) { var requestSerializer = JsonSerializer.Create(jsonSerializerSettings); requestSerializer.Serialize(requestWriter, requestBody); var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json"); request.Content = content; if (handleHeaders != null) { handleHeaders(request.Headers); } var responseMessage = await client.SendAsync(request); try { responseMessage.EnsureSuccessStatusCodeEx(); var stream = await responseMessage.Content.ReadAsStreamAsync(); using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream))) { var serializer = new JsonSerializer(); return(serializer.Deserialize <DeleteReportDefinitionResponse>(jsonReader)); } } finally { responseMessage.Dispose(); } } } }
/// <summary> /// Default constructor that Lambda will invoke. /// </summary> public Entrypoint() { Func <CustomResourceRequest, ILambdaContext, Task <CustomResourceResponse> > CreateAsync = async(request, context) => { string ReportName = String.Empty; try { //arn:aws:lambda:us-east-1:123456789012:function:FunctionName string[] Parts = context.InvokedFunctionArn.Split(":"); string Region = Parts[3]; string AccountId = Parts[4]; AmazonCostAndUsageReportConfig Config = new AmazonCostAndUsageReportConfig(); IAmazonCostAndUsageReport Client = new AmazonCostAndUsageReportClient(Config); PutReportDefinitionRequest Request = JsonConvert.DeserializeObject <PutReportDefinitionRequest>(JsonConvert.SerializeObject(request.ResourceProperties)); if (String.IsNullOrEmpty(Request.ReportDefinition.ReportName)) { Request.ReportDefinition.ReportName = request.LogicalResourceId; } ReportName = Request.ReportDefinition.ReportName; if (Request.ReportDefinition.AdditionalSchemaElements == null) { Request.ReportDefinition.AdditionalSchemaElements = new List <string>(); } // This is required to prevent this error: Value null at 'reportDefinition.additionalSchemaElements' failed to satisfy constraint: Member must not be null if (!Request.ReportDefinition.AdditionalSchemaElements.Contains("RESOURCES")) { Request.ReportDefinition.AdditionalSchemaElements.Add("RESOURCES"); } // Setup defaults for the definition if (String.IsNullOrEmpty(Request.ReportDefinition.S3Region)) { Request.ReportDefinition.S3Region = Region; } if (Request.ReportDefinition.TimeUnit == null || String.IsNullOrEmpty(Request.ReportDefinition.TimeUnit.Value)) { Request.ReportDefinition.TimeUnit = DefaultTimeUnit; } if (Request.ReportDefinition.AdditionalArtifacts != null && Request.ReportDefinition.AdditionalArtifacts.Any(x => x.Equals("ATHENA", StringComparison.OrdinalIgnoreCase)) ) { if (Request.ReportDefinition.AdditionalArtifacts.Count > 1) { throw new InvalidOperationException("The additional artifact ATHENA cannot be combined with other values."); } if (Request.ReportDefinition.Format != ReportFormat.Parquet || Request.ReportDefinition.Compression != CompressionFormat.Parquet) { throw new InvalidOperationException("You must specify Parquet as the format and compression type when ATHENA is specified as the additional artifact."); } } else if (Request.ReportDefinition.AdditionalArtifacts.Any(x => x.Equals("REDSHIFT", StringComparison.OrdinalIgnoreCase) || x.Equals("QUICKSIGHT", StringComparison.OrdinalIgnoreCase))) { if (Request.ReportDefinition.Format != ReportFormat.TextORcsv || Request.ReportDefinition.Compression != CompressionFormat.GZIP) { throw new InvalidOperationException("You must specify TextORCsv as the format and GZIP as the compression type when REDSHIFT or QUICKSIGHT are specified as the additional artifacts."); } } else { if (Request.ReportDefinition.Compression == null || String.IsNullOrEmpty(Request.ReportDefinition.Compression.Value)) { Request.ReportDefinition.Compression = DefaultCompression; } if (Request.ReportDefinition.Format == null || String.IsNullOrEmpty(Request.ReportDefinition.Format.Value)) { Request.ReportDefinition.Format = DefaultFormat; } } PutReportDefinitionResponse Response = await Client.PutReportDefinitionAsync(Request); if ((int)Response.HttpStatusCode < 200 || (int)Response.HttpStatusCode > 299) { return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.FAILED, $"Received HTTP status code {(int)Response.HttpStatusCode}.", request )); } else { return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.SUCCESS, $"See the details in CloudWatch Log Stream: {context.LogStreamName}.", Request.ReportDefinition.ReportName, request.StackId, request.RequestId, request.LogicalResourceId, false, new Dictionary <string, object>() { { "Name", Request.ReportDefinition.ReportName }, { "Arn", $"arn:aws:cur:{Region}:{AccountId}:definition/{ReportName}" }, { "Id", Request.ReportDefinition.ReportName } } )); } } catch (AmazonCostAndUsageReportException e) { context.LogError(e); return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.FAILED, e.Message, ReportName, request.StackId, request.RequestId, request.LogicalResourceId )); } catch (Exception e) { context.LogError(e); return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.FAILED, e.Message, ReportName, request.StackId, request.RequestId, request.LogicalResourceId )); } }; Func <CustomResourceRequest, ILambdaContext, Task <CustomResourceResponse> > DeleteAsync = async(request, context) => { try { //arn:aws:lambda:us-east-1:123456789012:function:FunctionName string[] Parts = context.InvokedFunctionArn.Split(":"); string Region = Parts[3]; string AccountId = Parts[4]; AmazonCostAndUsageReportConfig Config = new AmazonCostAndUsageReportConfig(); IAmazonCostAndUsageReport Client = new AmazonCostAndUsageReportClient(Config); DeleteReportDefinitionRequest Request = new DeleteReportDefinitionRequest() { ReportName = request.PhysicalResourceId }; DeleteReportDefinitionResponse Response = await Client.DeleteReportDefinitionAsync(Request); if ((int)Response.HttpStatusCode < 200 || (int)Response.HttpStatusCode > 299) { return(new CustomResourceResponse(CustomResourceResponse.RequestStatus.FAILED, $"Received HTTP status code {(int)Response.HttpStatusCode}.", request)); } else { return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.SUCCESS, $"See the details in CloudWatch Log Stream: {context.LogStreamName}.", request.PhysicalResourceId, request.StackId, request.RequestId, request.LogicalResourceId, false, new Dictionary <string, object>() { { "Name", request.PhysicalResourceId as string }, { "Arn", $"arn:aws:cur:{Region}:{AccountId}:definition/{request.PhysicalResourceId}" }, { "Id", request.PhysicalResourceId as string } } )); } } catch (AmazonCostAndUsageReportException e) { context.LogError(e); return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.FAILED, e.Message, request.PhysicalResourceId, request.StackId, request.RequestId, request.LogicalResourceId )); } catch (Exception e) { context.LogError(e); return(new CustomResourceResponse( CustomResourceResponse.RequestStatus.FAILED, e.Message, request.PhysicalResourceId, request.StackId, request.RequestId, request.LogicalResourceId )); } }; Func <CustomResourceRequest, ILambdaContext, Task <CustomResourceResponse> > UpdateAsync = async(request, context) => { CustomResourceResponse Response = await DeleteAsync(request, context); if (Response.Status == CustomResourceResponse.RequestStatus.SUCCESS) { return(await CreateAsync(request, context)); } else { return(Response); } }; this._Handler = new CustomResourceFactory(CreateAsync, UpdateAsync, DeleteAsync); this.ProcessEnvironmentVariables(); }