com.amazonaws.Request.setResourcePath()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(16.0k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中com.amazonaws.Request.setResourcePath方法的一些代码示例,展示了Request.setResourcePath的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.setResourcePath方法的具体详情如下:
包路径:com.amazonaws.Request
类名称:Request
方法名:setResourcePath

Request.setResourcePath介绍

[英]Sets the path to the resource being requested.
[中]设置要请求的资源的路径。

代码示例

代码示例来源:origin: aws/aws-sdk-java

public Request<GetCheckerIpRangesRequest> marshall(GetCheckerIpRangesRequest getCheckerIpRangesRequest) {
  if (getCheckerIpRangesRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<GetCheckerIpRangesRequest> request = new DefaultRequest<GetCheckerIpRangesRequest>(getCheckerIpRangesRequest, "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.GET);
  String uriResourcePath = "/2013-04-01/checkeripranges";
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

public Request<GetPublicAccessBlockRequest> marshall(GetPublicAccessBlockRequest getPublicAccessBlockRequest) {
  if (getPublicAccessBlockRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<GetPublicAccessBlockRequest> request = new DefaultRequest<GetPublicAccessBlockRequest>(getPublicAccessBlockRequest, "AWSS3Control");
  request.setHttpMethod(HttpMethodName.GET);
  if (getPublicAccessBlockRequest.getAccountId() != null) {
    request.addHeader("x-amz-account-id", StringUtils.fromString(getPublicAccessBlockRequest.getAccountId()));
  }
  String uriResourcePath = "/v20180820/configuration/publicAccessBlock";
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

@Override
public void beforeRequest(Request<?> request) {
  request.addHeader("x-amz-glacier-version", "2012-06-01");
  request.addHeader("x-amz-content-sha256", "required");
    if (resourcePath != null) {
      String newResourcePath = resourcePath.replace("{jobType}", "archive-retrievals");
      request.setResourcePath(newResourcePath);

代码示例来源:origin: aws/aws-sdk-java

public Request<UpdateHostedZoneCommentRequest> marshall(UpdateHostedZoneCommentRequest updateHostedZoneCommentRequest) {
  if (updateHostedZoneCommentRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<UpdateHostedZoneCommentRequest> request = new DefaultRequest<UpdateHostedZoneCommentRequest>(updateHostedZoneCommentRequest, "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.POST);
  String uriResourcePath = "/2013-04-01/hostedzone/{Id}";
  uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "Id", updateHostedZoneCommentRequest.getId());
  request.setResourcePath(uriResourcePath);
  try {
    StringWriter stringWriter = new StringWriter();
    XMLWriter xmlWriter = new XMLWriter(stringWriter, "https://route53.amazonaws.com/doc/2013-04-01/");
    xmlWriter.startElement("UpdateHostedZoneCommentRequest");
    if (updateHostedZoneCommentRequest != null) {
      if (updateHostedZoneCommentRequest.getComment() != null) {
        xmlWriter.startElement("Comment").value(updateHostedZoneCommentRequest.getComment()).endElement();
      }
    }
    xmlWriter.endElement();
    request.setContent(new StringInputStream(stringWriter.getBuffer().toString()));
    request.addHeader("Content-Length", Integer.toString(stringWriter.getBuffer().toString().getBytes(UTF8).length));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", "application/xml");
    }
  } catch (Throwable t) {
    throw new SdkClientException("Unable to marshall request to XML: " + t.getMessage(), t);
  }
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

@Override
  public Request<RawRequest> marshall(RawRequest rawRequestRequest) {
    if (rawRequestRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<RawRequest> request = new DefaultRequest<>("MyService");

    request.setHttpMethod(rawRequestRequest.httpMethod());
    request.setResourcePath(rawRequestRequest.path());
    request.setContent(rawRequestRequest.payload());

    // Custom headers and query params are set later in the runtime
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", protocolFactory.getContentType());
    }

    return request;
  }
}

代码示例来源:origin: aws/aws-sdk-java

private Request<OrigRequest> fillBasicRequestParams(OperationInfo operationInfo, OrigRequest originalRequest) {
  Request<OrigRequest> request = createRequest(operationInfo, originalRequest);
  request.setHttpMethod(operationInfo.httpMethodName());
  request.setResourcePath(UriResourcePathUtils.addStaticQueryParamtersToRequest(request, operationInfo.requestUri()));
  if (operationInfo.operationIdentifier() != null) {
    request.addHeader("X-Amz-Target", operationInfo.operationIdentifier());
  }
  return request;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

private Request<?> generateBasicRequest() {
  final Request<?> request = new DefaultRequest<Void>("Foo");
  request.setContent(new ByteArrayInputStream("{\"TableName\": \"foo\"}"
      .getBytes(StringUtils.UTF8)));
  request.addHeader("Host", "demo.us-east-1.amazonaws.com");
  // HTTP header containing multiple spaces in a row.
  request.addHeader("x-amz-archive-description", "test  test");
  request.setResourcePath("/");
  request.setEndpoint(URI.create("http://demo.us-east-1.amazonaws.com"));
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

@Override
public void marshall(T val, JsonMarshallerContext context, MarshallingInfo<T> marshallingInfo) {
  context.request().setResourcePath(
      pathMarshaller.marshall(context.request().getResourcePath(), marshallingInfo.marshallLocationName(),
                  converter.convert(val)));
}

代码示例来源:origin: aws/aws-sdk-java

public Request<UpdateTrafficPolicyCommentRequest> marshall(UpdateTrafficPolicyCommentRequest updateTrafficPolicyCommentRequest) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
      "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.POST);
  uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "Id", updateTrafficPolicyCommentRequest.getId());
  uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "Version",
      updateTrafficPolicyCommentRequest.getVersion());
  request.setResourcePath(uriResourcePath);
    StringWriter stringWriter = new StringWriter();
    XMLWriter xmlWriter = new XMLWriter(stringWriter, "https://route53.amazonaws.com/doc/2013-04-01/");
    request.setContent(new StringInputStream(stringWriter.getBuffer().toString()));
    request.addHeader("Content-Length", Integer.toString(stringWriter.getBuffer().toString().getBytes(UTF8).length));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", "application/xml");
    throw new SdkClientException("Unable to marshall request to XML: " + t.getMessage(), t);

代码示例来源:origin: aws/aws-sdk-java

public Request<GetHealthCheckCountRequest> marshall(GetHealthCheckCountRequest getHealthCheckCountRequest) {
  if (getHealthCheckCountRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<GetHealthCheckCountRequest> request = new DefaultRequest<GetHealthCheckCountRequest>(getHealthCheckCountRequest, "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.GET);
  String uriResourcePath = "/2013-04-01/healthcheckcount";
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

public Request<DeletePublicAccessBlockRequest> marshall(DeletePublicAccessBlockRequest deletePublicAccessBlockRequest) {
  if (deletePublicAccessBlockRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<DeletePublicAccessBlockRequest> request = new DefaultRequest<DeletePublicAccessBlockRequest>(deletePublicAccessBlockRequest, "AWSS3Control");
  request.setHttpMethod(HttpMethodName.DELETE);
  if (deletePublicAccessBlockRequest.getAccountId() != null) {
    request.addHeader("x-amz-account-id", StringUtils.fromString(deletePublicAccessBlockRequest.getAccountId()));
  }
  String uriResourcePath = "/v20180820/configuration/publicAccessBlock";
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

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

    Request<DescribeLimitsRequest> request = new DefaultRequest<DescribeLimitsRequest>(
        describeLimitsRequest, "AmazonDynamoDB");
    String target = "DynamoDB_20120810.DescribeLimits";
    request.addHeader("X-Amz-Target", target);
    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/";
    request.setResourcePath(uriResourcePath);
    request.addHeader("Content-Length", "0");
    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", "application/x-amz-json-1.0");
    }

    return request;
  }
}

代码示例来源:origin: aws-amplify/aws-sdk-android

@Test
public void testconvertRequestToUrl() throws MalformedURLException {
  final Request<?> request = new DefaultRequest<Void>("Foo");
  request.setContent(new ByteArrayInputStream("testcontent"
      .getBytes(StringUtils.UTF8)));
  request.addHeader("Host", "demo.us-east-1.amazonaws.com");
  // HTTP header containing multiple spaces in a row.
  request.addHeader("x-amz-archive-description", "test  test");
  request.setResourcePath("/");
  request.setEndpoint(URI.create("http://demo.us-east-1.amazonaws.com"));
  final Map<String, String> parameters = new HashMap<String, String>();
  parameters.put("foo", "bar");
  parameters.put("temple", "run");
  request.setParameters(parameters);
  final RuntimeHttpUtils utils = new RuntimeHttpUtils();
  Assert.assertEquals(new URL("http://demo.us-east-1.amazonaws.com/?foo=bar&temple=run"),
      RuntimeHttpUtils.convertRequestToUrl(request, true, false));
}

代码示例来源:origin: aws/aws-sdk-java

public Request<CreateQueryLoggingConfigRequest> marshall(CreateQueryLoggingConfigRequest createQueryLoggingConfigRequest) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  request.setHttpMethod(HttpMethodName.POST);
  request.setResourcePath(uriResourcePath);
    StringWriter stringWriter = new StringWriter();
    XMLWriter xmlWriter = new XMLWriter(stringWriter, "https://route53.amazonaws.com/doc/2013-04-01/");
    request.setContent(new StringInputStream(stringWriter.getBuffer().toString()));
    request.addHeader("Content-Length", Integer.toString(stringWriter.getBuffer().toString().getBytes(UTF8).length));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", "application/xml");
    throw new SdkClientException("Unable to marshall request to XML: " + t.getMessage(), t);

代码示例来源:origin: aws/aws-sdk-java

public Request<GetHostedZoneCountRequest> marshall(GetHostedZoneCountRequest getHostedZoneCountRequest) {
  if (getHostedZoneCountRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<GetHostedZoneCountRequest> request = new DefaultRequest<GetHostedZoneCountRequest>(getHostedZoneCountRequest, "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.GET);
  String uriResourcePath = "/2013-04-01/hostedzonecount";
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

public Request<DeletePublicKeyRequest> marshall(DeletePublicKeyRequest deletePublicKeyRequest) {
  if (deletePublicKeyRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<DeletePublicKeyRequest> request = new DefaultRequest<DeletePublicKeyRequest>(deletePublicKeyRequest, "AmazonCloudFront");
  request.setHttpMethod(HttpMethodName.DELETE);
  if (deletePublicKeyRequest.getIfMatch() != null) {
    request.addHeader("If-Match", StringUtils.fromString(deletePublicKeyRequest.getIfMatch()));
  }
  String uriResourcePath = "/2018-11-05/public-key/{Id}";
  uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "Id", deletePublicKeyRequest.getId());
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

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

    Request<DescribeEndpointsRequest> request = new DefaultRequest<DescribeEndpointsRequest>(
        describeEndpointsRequest, "AmazonDynamoDB");
    String target = "DynamoDB_20120810.DescribeEndpoints";
    request.addHeader("X-Amz-Target", target);
    request.setHttpMethod(HttpMethodName.POST);

    String uriResourcePath = "/";
    request.setResourcePath(uriResourcePath);
    request.addHeader("Content-Length", "0");
    request.setContent(new ByteArrayInputStream(new byte[0]));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", "application/x-amz-json-1.0");
    }

    return request;
  }
}

代码示例来源:origin: aws/aws-sdk-java

public Request<CreateReusableDelegationSetRequest> marshall(CreateReusableDelegationSetRequest createReusableDelegationSetRequest) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
      "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.POST);
  request.setResourcePath(uriResourcePath);
    StringWriter stringWriter = new StringWriter();
    XMLWriter xmlWriter = new XMLWriter(stringWriter, "https://route53.amazonaws.com/doc/2013-04-01/");
    request.setContent(new StringInputStream(stringWriter.getBuffer().toString()));
    request.addHeader("Content-Length", Integer.toString(stringWriter.getBuffer().toString().getBytes(UTF8).length));
    if (!request.getHeaders().containsKey("Content-Type")) {
      request.addHeader("Content-Type", "application/xml");
    throw new SdkClientException("Unable to marshall request to XML: " + t.getMessage(), t);

代码示例来源:origin: aws/aws-sdk-java

public Request<GetTrafficPolicyInstanceCountRequest> marshall(GetTrafficPolicyInstanceCountRequest getTrafficPolicyInstanceCountRequest) {
  if (getTrafficPolicyInstanceCountRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<GetTrafficPolicyInstanceCountRequest> request = new DefaultRequest<GetTrafficPolicyInstanceCountRequest>(getTrafficPolicyInstanceCountRequest,
      "AmazonRoute53");
  request.setHttpMethod(HttpMethodName.GET);
  String uriResourcePath = "/2013-04-01/trafficpolicyinstancecount";
  request.setResourcePath(uriResourcePath);
  return request;
}

代码示例来源:origin: aws/aws-sdk-java

public Request<DeleteDistributionRequest> marshall(DeleteDistributionRequest deleteDistributionRequest) {
  if (deleteDistributionRequest == null) {
    throw new SdkClientException("Invalid argument passed to marshall(...)");
  }
  Request<DeleteDistributionRequest> request = new DefaultRequest<DeleteDistributionRequest>(deleteDistributionRequest, "AmazonCloudFront");
  request.setHttpMethod(HttpMethodName.DELETE);
  if (deleteDistributionRequest.getIfMatch() != null) {
    request.addHeader("If-Match", StringUtils.fromString(deleteDistributionRequest.getIfMatch()));
  }
  String uriResourcePath = "/2018-11-05/distribution/{Id}";
  uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "Id", deleteDistributionRequest.getId());
  request.setResourcePath(uriResourcePath);
  return request;
}

相关文章