public Request<GetCloudFrontOriginAccessIdentityConfigRequest> marshall(
      GetCloudFrontOriginAccessIdentityConfigRequest
          getCloudFrontOriginAccessIdentityConfigRequest) {
    if (getCloudFrontOriginAccessIdentityConfigRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<GetCloudFrontOriginAccessIdentityConfigRequest> request =
        new DefaultRequest<GetCloudFrontOriginAccessIdentityConfigRequest>(
            getCloudFrontOriginAccessIdentityConfigRequest, "AmazonCloudFront");
    request.setHttpMethod(HttpMethodName.GET);

    String uriResourcePath = "2012-03-15/origin-access-identity/cloudfront/{Id}/config";
    uriResourcePath =
        uriResourcePath.replace(
            "{Id}", getString(getCloudFrontOriginAccessIdentityConfigRequest.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;
  }
コード例 #2
0
  public Request<ListBootstrapActionsRequest> marshall(
      ListBootstrapActionsRequest listBootstrapActionsRequest) {
    if (listBootstrapActionsRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<ListBootstrapActionsRequest> request =
        new DefaultRequest<ListBootstrapActionsRequest>(
            listBootstrapActionsRequest, "AmazonElasticMapReduce");
    String target = "ElasticMapReduce.ListBootstrapActions";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      if (listBootstrapActionsRequest.getClusterId() != null) {
        jsonWriter.key("ClusterId").value(listBootstrapActionsRequest.getClusterId());
      }
      if (listBootstrapActionsRequest.getMarker() != null) {
        jsonWriter.key("Marker").value(listBootstrapActionsRequest.getMarker());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", "application/x-amz-json-1.1");
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
コード例 #3
0
  public Request<DescribeInterconnectsRequest> marshall(
      DescribeInterconnectsRequest describeInterconnectsRequest) {
    if (describeInterconnectsRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeInterconnectsRequest> request =
        new DefaultRequest<DescribeInterconnectsRequest>(
            describeInterconnectsRequest, "AmazonDirectConnect");
    String target = "OvertureService.DescribeInterconnects";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      if (describeInterconnectsRequest.getInterconnectId() != null) {
        jsonWriter.key("interconnectId").value(describeInterconnectsRequest.getInterconnectId());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", "application/x-amz-json-1.1");
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

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

    Request<EnableDomainTransferLockRequest> request =
        new DefaultRequest<EnableDomainTransferLockRequest>(
            enableDomainTransferLockRequest, "AmazonRoute53Domains");
    String target = "Route53Domains_v20140515.EnableDomainTransferLock";
    request.addHeader("X-Amz-Target", target);

    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath("");

    try {
      StringWriter stringWriter = new StringWriter();
      JSONWriter jsonWriter = new JSONWriter(stringWriter);

      jsonWriter.object();

      if (enableDomainTransferLockRequest.getDomainName() != null) {
        jsonWriter.key("DomainName").value(enableDomainTransferLockRequest.getDomainName());
      }

      jsonWriter.endObject();

      String snippet = stringWriter.toString();
      byte[] content = snippet.getBytes(UTF8);
      request.setContent(new StringInputStream(snippet));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", "application/x-amz-json-1.1");
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }