/**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<DescribeImportSnapshotTasksRequest> getDryRunRequest() {
   Request<DescribeImportSnapshotTasksRequest> request =
       new DescribeImportSnapshotTasksRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<DescribeInstanceAttributeRequest> getDryRunRequest() {
   Request<DescribeInstanceAttributeRequest> request =
       new DescribeInstanceAttributeRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<PurchaseReservedInstancesOfferingRequest> getDryRunRequest() {
   Request<PurchaseReservedInstancesOfferingRequest> request =
       new PurchaseReservedInstancesOfferingRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
  public Request<SendMessageRequest> marshall(SendMessageRequest sendMessageRequest) {

    if (sendMessageRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<SendMessageRequest> request =
        new DefaultRequest<SendMessageRequest>(sendMessageRequest, "AmazonSQS");
    request.addParameter("Action", "SendMessage");
    request.addParameter("Version", "2012-11-05");

    if (sendMessageRequest.getQueueUrl() != null) {
      request.addParameter("QueueUrl", StringUtils.fromString(sendMessageRequest.getQueueUrl()));
    }
    if (sendMessageRequest.getMessageBody() != null) {
      request.addParameter(
          "MessageBody", StringUtils.fromString(sendMessageRequest.getMessageBody()));
    }
    if (sendMessageRequest.getDelaySeconds() != null) {
      request.addParameter(
          "DelaySeconds", StringUtils.fromInteger(sendMessageRequest.getDelaySeconds()));
    }

    return request;
  }
  public Request<MonitorInstancesRequest> marshall(
      MonitorInstancesRequest monitorInstancesRequest) {

    if (monitorInstancesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<MonitorInstancesRequest> request =
        new DefaultRequest<MonitorInstancesRequest>(monitorInstancesRequest, "AmazonEC2");
    request.addParameter("Action", "MonitorInstances");
    request.addParameter("Version", "2012-08-15");

    java.util.List<String> instanceIdsList = monitorInstancesRequest.getInstanceIds();
    int instanceIdsListIndex = 1;

    for (String instanceIdsListValue : instanceIdsList) {
      if (instanceIdsListValue != null) {
        request.addParameter(
            "InstanceId." + instanceIdsListIndex, StringUtils.fromString(instanceIdsListValue));
      }

      instanceIdsListIndex++;
    }

    return request;
  }
  public Request<GetHostedZoneRequest> marshall(GetHostedZoneRequest getHostedZoneRequest) {
    if (getHostedZoneRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<GetHostedZoneRequest> request =
        new DefaultRequest<GetHostedZoneRequest>(getHostedZoneRequest, "AmazonRoute53");
    request.setHttpMethod(HttpMethodName.GET);

    String uriResourcePath = "/2012-02-29/hostedzone/{Id}";
    uriResourcePath = uriResourcePath.replace("{Id}", getString(getHostedZoneRequest.getId()));

    if (uriResourcePath.contains("?")) {
      String queryString = uriResourcePath.substring(uriResourcePath.indexOf("?") + 1);
      uriResourcePath = uriResourcePath.substring(0, uriResourcePath.indexOf("?"));

      for (String s : queryString.split("[ &]")) {
        String[] nameValuePair = s.split("=");
        if (nameValuePair.length == 2) {
          request.addParameter(nameValuePair[0], nameValuePair[1]);
        } else {
          request.addParameter(s, null);
        }
      }
    }

    request.setResourcePath(uriResourcePath);

    return request;
  }
  /**
   * Sends a signal to the specified resource with a success or failure status. You can use the
   * SignalResource API in conjunction with a creation policy or update policy. AWS CloudFormation
   * doesn't proceed with a stack creation or update until resources receive the required number of
   * signals or the timeout period is exceeded. The SignalResource API is useful in cases where you
   * want to send signals from anywhere other than an Amazon EC2 instance.
   *
   * @param signalResourceRequest The input for the <a>SignalResource</a> action.
   * @sample AmazonCloudFormation.SignalResource
   */
  @Override
  public void signalResource(SignalResourceRequest signalResourceRequest) {
    ExecutionContext executionContext = createExecutionContext(signalResourceRequest);
    AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
    awsRequestMetrics.startEvent(Field.ClientExecuteTime);
    Request<SignalResourceRequest> request = null;
    Response<Void> response = null;

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

      StaxResponseHandler<Void> responseHandler = new StaxResponseHandler<Void>(null);
      invoke(request, responseHandler, executionContext);

    } finally {

      endClientExecution(awsRequestMetrics, request, response);
    }
  }
  public Request<DescribeStackResourceRequest> marshall(
      DescribeStackResourceRequest describeStackResourceRequest) {

    if (describeStackResourceRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeStackResourceRequest> request =
        new DefaultRequest<DescribeStackResourceRequest>(
            describeStackResourceRequest, "AmazonCloudFormation");
    request.addParameter("Action", "DescribeStackResource");
    request.addParameter("Version", "2010-05-15");

    if (describeStackResourceRequest.getStackName() != null) {
      request.addParameter(
          "StackName", StringUtils.fromString(describeStackResourceRequest.getStackName()));
    }
    if (describeStackResourceRequest.getLogicalResourceId() != null) {
      request.addParameter(
          "LogicalResourceId",
          StringUtils.fromString(describeStackResourceRequest.getLogicalResourceId()));
    }

    return request;
  }
  public Request<DeleteReusableDelegationSetRequest> marshall(
      DeleteReusableDelegationSetRequest deleteReusableDelegationSetRequest) {

    if (deleteReusableDelegationSetRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DeleteReusableDelegationSetRequest> request =
        new DefaultRequest<DeleteReusableDelegationSetRequest>(
            deleteReusableDelegationSetRequest, "AmazonRoute53");

    request.setHttpMethod(HttpMethodName.DELETE);

    String uriResourcePath = "/2013-04-01/delegationset/{Id}";

    uriResourcePath =
        uriResourcePath.replace(
            "{Id}",
            (deleteReusableDelegationSetRequest.getId() == null)
                ? ""
                : StringUtils.fromString(deleteReusableDelegationSetRequest.getId()));
    request.setResourcePath(uriResourcePath);

    return request;
  }
  public Request<DescribeApplicationsRequest> marshall(
      DescribeApplicationsRequest describeApplicationsRequest) {

    if (describeApplicationsRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeApplicationsRequest> request =
        new DefaultRequest<DescribeApplicationsRequest>(
            describeApplicationsRequest, "AWSElasticBeanstalk");
    request.addParameter("Action", "DescribeApplications");
    request.addParameter("Version", "2010-12-01");
    request.setHttpMethod(HttpMethodName.POST);

    com.amazonaws.internal.SdkInternalList<String> applicationNamesList =
        (com.amazonaws.internal.SdkInternalList<String>)
            describeApplicationsRequest.getApplicationNames();
    if (!applicationNamesList.isEmpty() || !applicationNamesList.isAutoConstruct()) {
      int applicationNamesListIndex = 1;

      for (String applicationNamesListValue : applicationNamesList) {
        if (applicationNamesListValue != null) {
          request.addParameter(
              "ApplicationNames.member." + applicationNamesListIndex,
              StringUtils.fromString(applicationNamesListValue));
        }
        applicationNamesListIndex++;
      }
    }

    return request;
  }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<DeleteEgressOnlyInternetGatewayRequest> getDryRunRequest() {
   Request<DeleteEgressOnlyInternetGatewayRequest> request =
       new DeleteEgressOnlyInternetGatewayRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<ReplaceNetworkAclEntryRequest> getDryRunRequest() {
   Request<ReplaceNetworkAclEntryRequest> request =
       new ReplaceNetworkAclEntryRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
Exemplo n.º 13
0
  private <X, Y extends AmazonWebServiceRequest> X invoke(
      Request<Y> request, Unmarshaller<X, StaxUnmarshallerContext> unmarshaller) {
    request.setEndpoint(endpoint);
    request.setTimeOffset(timeOffset);
    for (Entry<String, String> entry :
        request.getOriginalRequest().copyPrivateRequestParameters().entrySet()) {
      request.addParameter(entry.getKey(), entry.getValue());
    }

    AWSCredentials credentials = awsCredentialsProvider.getCredentials();
    AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
    if (originalRequest != null && originalRequest.getRequestCredentials() != null) {
      credentials = originalRequest.getRequestCredentials();
    }

    ExecutionContext executionContext = createExecutionContext();
    executionContext.setSigner(signer);
    executionContext.setCredentials(credentials);

    StaxResponseHandler<X> responseHandler = new StaxResponseHandler<X>(unmarshaller);
    DefaultErrorResponseHandler errorResponseHandler =
        new DefaultErrorResponseHandler(exceptionUnmarshallers);

    return (X) client.execute(request, responseHandler, errorResponseHandler, executionContext);
  }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<DeleteSpotDatafeedSubscriptionRequest> getDryRunRequest() {
   Request<DeleteSpotDatafeedSubscriptionRequest> request =
       new DeleteSpotDatafeedSubscriptionRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<AssociateRouteTableRequest> getDryRunRequest() {
   Request<AssociateRouteTableRequest> request =
       new AssociateRouteTableRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<AttachNetworkInterfaceRequest> getDryRunRequest() {
   Request<AttachNetworkInterfaceRequest> request =
       new AttachNetworkInterfaceRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
  public Request<DisableVgwRoutePropagationRequest> marshall(
      DisableVgwRoutePropagationRequest disableVgwRoutePropagationRequest) {

    if (disableVgwRoutePropagationRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DisableVgwRoutePropagationRequest> request =
        new DefaultRequest<DisableVgwRoutePropagationRequest>(
            disableVgwRoutePropagationRequest, "AmazonEC2");
    request.addParameter("Action", "DisableVgwRoutePropagation");
    request.addParameter("Version", "2015-10-01");

    if (disableVgwRoutePropagationRequest.getRouteTableId() != null) {
      request.addParameter(
          "RouteTableId",
          StringUtils.fromString(disableVgwRoutePropagationRequest.getRouteTableId()));
    }
    if (disableVgwRoutePropagationRequest.getGatewayId() != null) {
      request.addParameter(
          "GatewayId", StringUtils.fromString(disableVgwRoutePropagationRequest.getGatewayId()));
    }

    return request;
  }
  public Request<ResumeProcessesRequest> marshall(ResumeProcessesRequest resumeProcessesRequest) {

    if (resumeProcessesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<ResumeProcessesRequest> request =
        new DefaultRequest<ResumeProcessesRequest>(resumeProcessesRequest, "AmazonAutoScaling");
    request.addParameter("Action", "ResumeProcesses");
    request.addParameter("Version", "2011-01-01");

    if (resumeProcessesRequest.getAutoScalingGroupName() != null) {
      request.addParameter(
          "AutoScalingGroupName",
          StringUtils.fromString(resumeProcessesRequest.getAutoScalingGroupName()));
    }

    java.util.List<String> scalingProcessesList = resumeProcessesRequest.getScalingProcesses();
    int scalingProcessesListIndex = 1;

    for (String scalingProcessesListValue : scalingProcessesList) {
      if (scalingProcessesListValue != null) {
        request.addParameter(
            "ScalingProcesses.member." + scalingProcessesListIndex,
            StringUtils.fromString(scalingProcessesListValue));
      }

      scalingProcessesListIndex++;
    }

    return request;
  }
  private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(
      Request<Y> request,
      HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
      ExecutionContext executionContext) {
    request.setEndpoint(endpoint);
    request.setTimeOffset(timeOffset);

    AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
    AWSCredentials credentials;
    awsRequestMetrics.startEvent(Field.CredentialsRequestTime);
    try {
      credentials = awsCredentialsProvider.getCredentials();
    } finally {
      awsRequestMetrics.endEvent(Field.CredentialsRequestTime);
    }

    AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
    if (originalRequest != null && originalRequest.getRequestCredentials() != null) {
      credentials = originalRequest.getRequestCredentials();
    }

    executionContext.setCredentials(credentials);

    DefaultErrorResponseHandler errorResponseHandler =
        new DefaultErrorResponseHandler(exceptionUnmarshallers);

    return client.execute(request, responseHandler, errorResponseHandler, executionContext);
  }
  public Request<DeleteNotificationConfigurationRequest> marshall(
      DeleteNotificationConfigurationRequest deleteNotificationConfigurationRequest) {

    if (deleteNotificationConfigurationRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DeleteNotificationConfigurationRequest> request =
        new DefaultRequest<DeleteNotificationConfigurationRequest>(
            deleteNotificationConfigurationRequest, "AmazonAutoScaling");
    request.addParameter("Action", "DeleteNotificationConfiguration");
    request.addParameter("Version", "2011-01-01");

    if (deleteNotificationConfigurationRequest.getAutoScalingGroupName() != null) {
      request.addParameter(
          "AutoScalingGroupName",
          StringUtils.fromString(deleteNotificationConfigurationRequest.getAutoScalingGroupName()));
    }
    if (deleteNotificationConfigurationRequest.getTopicARN() != null) {
      request.addParameter(
          "TopicARN", StringUtils.fromString(deleteNotificationConfigurationRequest.getTopicARN()));
    }

    return request;
  }
  /**
   * 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);
    }
  }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<ReportInstanceStatusRequest> getDryRunRequest() {
   Request<ReportInstanceStatusRequest> request =
       new ReportInstanceStatusRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<TerminateInstancesRequest> getDryRunRequest() {
   Request<TerminateInstancesRequest> request =
       new TerminateInstancesRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<DescribeStaleSecurityGroupsRequest> getDryRunRequest() {
   Request<DescribeStaleSecurityGroupsRequest> request =
       new DescribeStaleSecurityGroupsRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<ModifySnapshotAttributeRequest> getDryRunRequest() {
   Request<ModifySnapshotAttributeRequest> request =
       new ModifySnapshotAttributeRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<CreateCustomerGatewayRequest> getDryRunRequest() {
   Request<CreateCustomerGatewayRequest> request =
       new CreateCustomerGatewayRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
  public Request<DescribeLoadBalancerPolicyTypesRequest> marshall(
      DescribeLoadBalancerPolicyTypesRequest describeLoadBalancerPolicyTypesRequest) {

    if (describeLoadBalancerPolicyTypesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeLoadBalancerPolicyTypesRequest> request =
        new DefaultRequest<DescribeLoadBalancerPolicyTypesRequest>(
            describeLoadBalancerPolicyTypesRequest, "AmazonElasticLoadBalancing");
    request.addParameter("Action", "DescribeLoadBalancerPolicyTypes");
    request.addParameter("Version", "2012-06-01");

    java.util.List<String> policyTypeNamesList =
        describeLoadBalancerPolicyTypesRequest.getPolicyTypeNames();
    int policyTypeNamesListIndex = 1;

    for (String policyTypeNamesListValue : policyTypeNamesList) {
      if (policyTypeNamesListValue != null) {
        request.addParameter(
            "PolicyTypeNames.member." + policyTypeNamesListIndex,
            StringUtils.fromString(policyTypeNamesListValue));
      }

      policyTypeNamesListIndex++;
    }

    return request;
  }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<DetachClassicLinkVpcRequest> getDryRunRequest() {
   Request<DetachClassicLinkVpcRequest> request =
       new DetachClassicLinkVpcRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }
  public Request<ListCloudFrontOriginAccessIdentitiesRequest> marshall(
      ListCloudFrontOriginAccessIdentitiesRequest listCloudFrontOriginAccessIdentitiesRequest) {

    if (listCloudFrontOriginAccessIdentitiesRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<ListCloudFrontOriginAccessIdentitiesRequest> request =
        new DefaultRequest<ListCloudFrontOriginAccessIdentitiesRequest>(
            listCloudFrontOriginAccessIdentitiesRequest, "AmazonCloudFront");

    request.setHttpMethod(HttpMethodName.GET);

    String uriResourcePath = "/2016-01-28/origin-access-identity/cloudfront";

    request.setResourcePath(uriResourcePath);

    if (listCloudFrontOriginAccessIdentitiesRequest.getMarker() != null) {
      request.addParameter(
          "Marker",
          StringUtils.fromString(listCloudFrontOriginAccessIdentitiesRequest.getMarker()));
    }

    if (listCloudFrontOriginAccessIdentitiesRequest.getMaxItems() != null) {
      request.addParameter(
          "MaxItems",
          StringUtils.fromString(listCloudFrontOriginAccessIdentitiesRequest.getMaxItems()));
    }

    return request;
  }
 /**
  * This method is intended for internal use only. Returns the marshaled request configured with
  * additional parameters to enable operation dry-run.
  */
 @Override
 public Request<ModifyIdentityIdFormatRequest> getDryRunRequest() {
   Request<ModifyIdentityIdFormatRequest> request =
       new ModifyIdentityIdFormatRequestMarshaller().marshall(this);
   request.addParameter("DryRun", Boolean.toString(true));
   return request;
 }