コード例 #1
0
  /**
   * Validates a specified template.
   *
   * @param validateTemplateRequest The input for <a>ValidateTemplate</a> action.
   * @return Result of the ValidateTemplate operation returned by the service.
   * @sample AmazonCloudFormation.ValidateTemplate
   */
  @Override
  public ValidateTemplateResult validateTemplate(ValidateTemplateRequest validateTemplateRequest) {
    ExecutionContext executionContext = createExecutionContext(validateTemplateRequest);
    AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
    awsRequestMetrics.startEvent(Field.ClientExecuteTime);
    Request<ValidateTemplateRequest> request = null;
    Response<ValidateTemplateResult> response = null;

    try {
      awsRequestMetrics.startEvent(Field.RequestMarshallTime);
      try {
        request =
            new ValidateTemplateRequestMarshaller()
                .marshall(super.beforeMarshalling(validateTemplateRequest));
        // Binds the request metrics to the current request.
        request.setAWSRequestMetrics(awsRequestMetrics);
      } finally {
        awsRequestMetrics.endEvent(Field.RequestMarshallTime);
      }

      StaxResponseHandler<ValidateTemplateResult> responseHandler =
          new StaxResponseHandler<ValidateTemplateResult>(
              new ValidateTemplateResultStaxUnmarshaller());
      response = invoke(request, responseHandler, executionContext);

      return response.getAwsResponse();

    } finally {

      endClientExecution(awsRequestMetrics, request, response);
    }
  }
コード例 #2
0
 /**
  * Updates a stack as specified in the template. After the call completes successfully, the stack
  * update starts. You can check the status of the stack via the DescribeStacks action.
  *
  * <p>To get a copy of the template for an existing stack, you can use the GetTemplate action.
  *
  * <p>Tags that were associated with this stack during creation time will still be associated with
  * the stack after an <code>UpdateStack</code> operation.
  *
  * <p>For more information about creating an update template, updating a stack, and monitoring the
  * progress of the update, see <a
  * href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html">
  * Updating a Stack </a> .
  *
  * @param updateStackRequest Container for the necessary parameters to execute the UpdateStack
  *     service method on AmazonCloudFormation.
  * @return The response from the UpdateStack service method, as returned by AmazonCloudFormation.
  * @throws InsufficientCapabilitiesException
  * @throws AmazonClientException If any internal errors are encountered inside the client while
  *     attempting to make the request or handle the response. For example if a network connection
  *     is not available.
  * @throws AmazonServiceException If an error response is returned by AmazonCloudFormation
  *     indicating either a problem with the data in the request, or a server side issue.
  */
 public UpdateStackResult updateStack(UpdateStackRequest updateStackRequest) {
   ExecutionContext executionContext = createExecutionContext(updateStackRequest);
   AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
   Request<UpdateStackRequest> request = null;
   Response<UpdateStackResult> response = null;
   awsRequestMetrics.startEvent(Field.ClientExecuteTime);
   try {
     request = new UpdateStackRequestMarshaller().marshall(updateStackRequest);
     // Binds the request metrics to the current request.
     request.setAWSRequestMetrics(awsRequestMetrics);
     response = invoke(request, new UpdateStackResultStaxUnmarshaller(), executionContext);
     return response.getAwsResponse();
   } finally {
     endClientExecution(awsRequestMetrics, request, response);
   }
 }