public Request<DeleteVaultNotificationsRequest> marshall(
      DeleteVaultNotificationsRequest deleteVaultNotificationsRequest) {

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

    Request<DeleteVaultNotificationsRequest> request =
        new DefaultRequest<DeleteVaultNotificationsRequest>(
            deleteVaultNotificationsRequest, "AmazonGlacier");

    request.setHttpMethod(HttpMethodName.DELETE);

    String uriResourcePath = "/{accountId}/vaults/{vaultName}/notification-configuration";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath,
            "accountId",
            deleteVaultNotificationsRequest.getAccountId() == null
                ? "-"
                : deleteVaultNotificationsRequest.getAccountId());
    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "vaultName", deleteVaultNotificationsRequest.getVaultName());
    request.setResourcePath(uriResourcePath);

    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", protocolFactory.getContentType());
    }

    return request;
  }
コード例 #2
0
  public Request<UpdateMethodRequest> marshall(UpdateMethodRequest updateMethodRequest) {

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

    Request<UpdateMethodRequest> request =
        new DefaultRequest<UpdateMethodRequest>(updateMethodRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.PATCH);

    String uriResourcePath = "/restapis/{restapi_id}/resources/{resource_id}/methods/{http_method}";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "restapi_id", updateMethodRequest.getRestApiId());
    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "resource_id", updateMethodRequest.getResourceId());
    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "http_method", updateMethodRequest.getHttpMethod());
    request.setResourcePath(uriResourcePath);

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();
      jsonGenerator.writeStartObject();

      java.util.List<PatchOperation> patchOperationsList = updateMethodRequest.getPatchOperations();
      if (patchOperationsList != null) {
        jsonGenerator.writeFieldName("patchOperations");
        jsonGenerator.writeStartArray();
        for (PatchOperation patchOperationsListValue : patchOperationsList) {
          if (patchOperationsListValue != null) {

            PatchOperationJsonMarshaller.getInstance()
                .marshall(patchOperationsListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", protocolFactory.getContentType());
      }
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
コード例 #3
0
  public Request<GetStagesRequest> marshall(GetStagesRequest getStagesRequest) {

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

    Request<GetStagesRequest> request =
        new DefaultRequest<GetStagesRequest>(getStagesRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.GET);

    String uriResourcePath = "/restapis/{restapi_id}/stages";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "restapi_id", getStagesRequest.getRestApiId());
    request.setResourcePath(uriResourcePath);

    if (getStagesRequest.getDeploymentId() != null) {
      request.addParameter(
          "deploymentId", StringUtils.fromString(getStagesRequest.getDeploymentId()));
    }

    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", protocolFactory.getContentType());
    }

    return request;
  }
  public Request<DisableTopicRuleRequest> marshall(
      DisableTopicRuleRequest disableTopicRuleRequest) {

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

    Request<DisableTopicRuleRequest> request =
        new DefaultRequest<DisableTopicRuleRequest>(disableTopicRuleRequest, "AWSIot");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/rules/{ruleName}/disable";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "ruleName", disableTopicRuleRequest.getRuleName());
    request.setResourcePath(uriResourcePath);

    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", protocolFactory.getContentType());
    }

    return request;
  }
  public Request<PurchaseProvisionedCapacityRequest> marshall(
      PurchaseProvisionedCapacityRequest purchaseProvisionedCapacityRequest) {

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

    Request<PurchaseProvisionedCapacityRequest> request =
        new DefaultRequest<PurchaseProvisionedCapacityRequest>(
            purchaseProvisionedCapacityRequest, "AmazonGlacier");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/{accountId}/provisioned-capacity";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath,
            "accountId",
            purchaseProvisionedCapacityRequest.getAccountId() == null
                ? "-"
                : purchaseProvisionedCapacityRequest.getAccountId());
    request.setResourcePath(uriResourcePath);

    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", protocolFactory.getContentType());
    }

    return request;
  }
  public Request<CreateBasePathMappingRequest> marshall(
      CreateBasePathMappingRequest createBasePathMappingRequest) {

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

    Request<CreateBasePathMappingRequest> request =
        new DefaultRequest<CreateBasePathMappingRequest>(
            createBasePathMappingRequest, "AmazonApiGateway");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/domainnames/{domain_name}/basepathmappings";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "domain_name", createBasePathMappingRequest.getDomainName());
    request.setResourcePath(uriResourcePath);

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();
      jsonGenerator.writeStartObject();

      if (createBasePathMappingRequest.getBasePath() != null) {
        jsonGenerator
            .writeFieldName("basePath")
            .writeValue(createBasePathMappingRequest.getBasePath());
      }
      if (createBasePathMappingRequest.getRestApiId() != null) {
        jsonGenerator
            .writeFieldName("restApiId")
            .writeValue(createBasePathMappingRequest.getRestApiId());
      }
      if (createBasePathMappingRequest.getStage() != null) {
        jsonGenerator.writeFieldName("stage").writeValue(createBasePathMappingRequest.getStage());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", protocolFactory.getContentType());
      }
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
コード例 #7
0
  public Request<UpdatePipelineStatusRequest> marshall(
      UpdatePipelineStatusRequest updatePipelineStatusRequest) {

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

    Request<UpdatePipelineStatusRequest> request =
        new DefaultRequest<UpdatePipelineStatusRequest>(
            updatePipelineStatusRequest, "AmazonElasticTranscoder");

    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/2012-09-25/pipelines/{Id}/status";

    uriResourcePath =
        com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(
            uriResourcePath, "Id", updatePipelineStatusRequest.getId());
    request.setResourcePath(uriResourcePath);

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();
      jsonGenerator.writeStartObject();

      if (updatePipelineStatusRequest.getStatus() != null) {
        jsonGenerator.writeFieldName("Status").writeValue(updatePipelineStatusRequest.getStatus());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      if (!request.getHeaders().containsKey("Content-Type")) {
        request.addHeader("Content-Type", protocolFactory.getContentType());
      }
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }