public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ConfigService.Model.StartConfigRulesEvaluationRequest(); if (cmdletContext.ConfigRuleName != null) { request.ConfigRuleNames = cmdletContext.ConfigRuleName; } 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); }
private Amazon.ConfigService.Model.StartConfigRulesEvaluationResponse CallAWSServiceOperation(IAmazonConfigService client, Amazon.ConfigService.Model.StartConfigRulesEvaluationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Config", "StartConfigRulesEvaluation"); try { #if DESKTOP return(client.StartConfigRulesEvaluation(request)); #elif CORECLR return(client.StartConfigRulesEvaluationAsync(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> /// Runs an on-demand evaluation for the specified Config rules against the last known /// configuration state of the resources. Use <code>StartConfigRulesEvaluation</code> /// when you want to test a rule that you updated is working as expected. <code>StartConfigRulesEvaluation</code> /// does not re-record the latest configuration state for your resources; it re-runs an /// evaluation against the last known state of your resources. /// /// /// <para> /// You can specify up to 25 Config rules per request. /// </para> /// /// <para> /// An existing <code>StartConfigRulesEvaluation</code> call must complete for the specified /// rules before you can call the API again. If you chose to have AWS Config stream to /// an Amazon SNS topic, you will receive a <code>ConfigRuleEvaluationStarted</code> notification /// when the evaluation starts. /// </para> /// <note> /// <para> /// You don't need to call the <code>StartConfigRulesEvaluation</code> API to run an evaluation /// for a new rule. When you create a new rule, AWS Config automatically evaluates your /// resources against the rule. /// </para> /// </note> /// <para> /// The <code>StartConfigRulesEvaluation</code> API is useful if you want to run on-demand /// evaluations, such as the following example: /// </para> /// <ol> <li> /// <para> /// You have a custom rule that evaluates your IAM resources every 24 hours. /// </para> /// </li> <li> /// <para> /// You update your Lambda function to add additional conditions to your rule. /// </para> /// </li> <li> /// <para> /// Instead of waiting for the next periodic evaluation, you call the <code>StartConfigRulesEvaluation</code> /// API. /// </para> /// </li> <li> /// <para> /// AWS Config invokes your Lambda function and evaluates your IAM resources. /// </para> /// </li> <li> /// <para> /// Your custom rule will still run periodic evaluations every 24 hours. /// </para> /// </li> </ol> /// </summary> /// <param name="request">Container for the necessary parameters to execute the StartConfigRulesEvaluation service method.</param> /// /// <returns>The response from the StartConfigRulesEvaluation service method, as returned by ConfigService.</returns> /// <exception cref="Amazon.ConfigService.Model.InvalidParameterValueException"> /// One or more of the specified parameters are invalid. Verify that your parameters are /// valid and try again. /// </exception> /// <exception cref="Amazon.ConfigService.Model.LimitExceededException"> /// This exception is thrown if an evaluation is in progress or if you call the <a>StartConfigRulesEvaluation</a> /// API more than once per minute. /// </exception> /// <exception cref="Amazon.ConfigService.Model.NoSuchConfigRuleException"> /// One or more AWS Config rules in the request are invalid. Verify that the rule names /// are correct and try again. /// </exception> /// <exception cref="Amazon.ConfigService.Model.ResourceInUseException"> /// The rule is currently being deleted or the rule is deleting your evaluation results. /// Try your request again later. /// </exception> public StartConfigRulesEvaluationResponse StartConfigRulesEvaluation(StartConfigRulesEvaluationRequest request) { var marshaller = new StartConfigRulesEvaluationRequestMarshaller(); var unmarshaller = StartConfigRulesEvaluationResponseUnmarshaller.Instance; return Invoke<StartConfigRulesEvaluationRequest,StartConfigRulesEvaluationResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the StartConfigRulesEvaluation operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the StartConfigRulesEvaluation 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<StartConfigRulesEvaluationResponse> StartConfigRulesEvaluationAsync(StartConfigRulesEvaluationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new StartConfigRulesEvaluationRequestMarshaller(); var unmarshaller = StartConfigRulesEvaluationResponseUnmarshaller.Instance; return InvokeAsync<StartConfigRulesEvaluationRequest,StartConfigRulesEvaluationResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the StartConfigRulesEvaluation operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the StartConfigRulesEvaluation operation on AmazonConfigServiceClient.</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 EndStartConfigRulesEvaluation /// operation.</returns> public IAsyncResult BeginStartConfigRulesEvaluation(StartConfigRulesEvaluationRequest request, AsyncCallback callback, object state) { var marshaller = new StartConfigRulesEvaluationRequestMarshaller(); var unmarshaller = StartConfigRulesEvaluationResponseUnmarshaller.Instance; return BeginInvoke<StartConfigRulesEvaluationRequest>(request, marshaller, unmarshaller, callback, state); }