コード例 #1
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(DocumentParameter documentParameter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (documentParameter.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(documentParameter.getName());
      }
      if (documentParameter.getType() != null) {
        jsonGenerator.writeFieldName("Type").writeValue(documentParameter.getType());
      }
      if (documentParameter.getDescription() != null) {
        jsonGenerator.writeFieldName("Description").writeValue(documentParameter.getDescription());
      }
      if (documentParameter.getDefaultValue() != null) {
        jsonGenerator
            .writeFieldName("DefaultValue")
            .writeValue(documentParameter.getDefaultValue());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      MaintenanceWindowFilter maintenanceWindowFilter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (maintenanceWindowFilter.getKey() != null) {
        jsonGenerator.writeFieldName("Key").writeValue(maintenanceWindowFilter.getKey());
      }

      com.amazonaws.internal.SdkInternalList<String> valuesList =
          (com.amazonaws.internal.SdkInternalList<String>) maintenanceWindowFilter.getValues();
      if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Values");
        jsonGenerator.writeStartArray();
        for (String valuesListValue : valuesList) {
          if (valuesListValue != null) {
            jsonGenerator.writeValue(valuesListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #3
0
  public Request<ListDocumentsRequest> marshall(ListDocumentsRequest listDocumentsRequest) {

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

    Request<ListDocumentsRequest> request =
        new DefaultRequest<ListDocumentsRequest>(
            listDocumentsRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.ListDocuments");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<DocumentFilter> documentFilterListList =
          (com.amazonaws.internal.SdkInternalList<DocumentFilter>)
              listDocumentsRequest.getDocumentFilterList();
      if (!documentFilterListList.isEmpty() || !documentFilterListList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("DocumentFilterList");
        jsonGenerator.writeStartArray();
        for (DocumentFilter documentFilterListListValue : documentFilterListList) {
          if (documentFilterListListValue != null) {

            DocumentFilterJsonMarshaller.getInstance()
                .marshall(documentFilterListListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (listDocumentsRequest.getMaxResults() != null) {
        jsonGenerator.writeFieldName("MaxResults").writeValue(listDocumentsRequest.getMaxResults());
      }
      if (listDocumentsRequest.getNextToken() != null) {
        jsonGenerator.writeFieldName("NextToken").writeValue(listDocumentsRequest.getNextToken());
      }

      jsonGenerator.writeEndObject();

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

    return request;
  }
  public Request<DescribeAssociationRequest> marshall(
      DescribeAssociationRequest describeAssociationRequest) {

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

    Request<DescribeAssociationRequest> request =
        new DefaultRequest<DescribeAssociationRequest>(
            describeAssociationRequest, "AWSSimpleSystemsManagement");
    request.addHeader("X-Amz-Target", "AmazonSSM.DescribeAssociation");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (describeAssociationRequest.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(describeAssociationRequest.getName());
      }
      if (describeAssociationRequest.getInstanceId() != null) {
        jsonGenerator
            .writeFieldName("InstanceId")
            .writeValue(describeAssociationRequest.getInstanceId());
      }
      if (describeAssociationRequest.getAssociationId() != null) {
        jsonGenerator
            .writeFieldName("AssociationId")
            .writeValue(describeAssociationRequest.getAssociationId());
      }

      jsonGenerator.writeEndObject();

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

    return request;
  }
コード例 #5
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      PatchComplianceData patchComplianceData, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (patchComplianceData.getTitle() != null) {
        jsonGenerator.writeFieldName("Title").writeValue(patchComplianceData.getTitle());
      }
      if (patchComplianceData.getKBId() != null) {
        jsonGenerator.writeFieldName("KBId").writeValue(patchComplianceData.getKBId());
      }
      if (patchComplianceData.getClassification() != null) {
        jsonGenerator
            .writeFieldName("Classification")
            .writeValue(patchComplianceData.getClassification());
      }
      if (patchComplianceData.getSeverity() != null) {
        jsonGenerator.writeFieldName("Severity").writeValue(patchComplianceData.getSeverity());
      }
      if (patchComplianceData.getState() != null) {
        jsonGenerator.writeFieldName("State").writeValue(patchComplianceData.getState());
      }
      if (patchComplianceData.getInstalledTime() != null) {
        jsonGenerator
            .writeFieldName("InstalledTime")
            .writeValue(patchComplianceData.getInstalledTime());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #6
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(LoggingInfo loggingInfo, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (loggingInfo.getS3BucketName() != null) {
        jsonGenerator.writeFieldName("S3BucketName").writeValue(loggingInfo.getS3BucketName());
      }
      if (loggingInfo.getS3KeyPrefix() != null) {
        jsonGenerator.writeFieldName("S3KeyPrefix").writeValue(loggingInfo.getS3KeyPrefix());
      }
      if (loggingInfo.getS3Region() != null) {
        jsonGenerator.writeFieldName("S3Region").writeValue(loggingInfo.getS3Region());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }