All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.servicediscovery.AWSServiceDiscoveryClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Route 53 Auto Naming module holds the client classes that are used for communicating with Amazon Route 53 Auto Naming Service

There is a newer version: 1.12.772
Show newest version
/*
 * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.servicediscovery;

import org.w3c.dom.*;

import java.net.*;
import java.util.*;

import javax.annotation.Generated;

import org.apache.commons.logging.*;

import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;

import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;

import com.amazonaws.services.servicediscovery.AWSServiceDiscoveryClientBuilder;

import com.amazonaws.AmazonServiceException;

import com.amazonaws.services.servicediscovery.model.*;
import com.amazonaws.services.servicediscovery.model.transform.*;

/**
 * Client for accessing ServiceDiscovery. All service calls made using this client are blocking, and will not return
 * until the service call completes.
 * 

*

* AWS Cloud Map lets you configure public DNS, private DNS, or HTTP namespaces that your microservice applications run * in. When an instance of the service becomes available, you can call the AWS Cloud Map API to register the instance * with AWS Cloud Map. For public or private DNS namespaces, AWS Cloud Map automatically creates DNS records and an * optional health check. Clients that submit public or private DNS queries, or HTTP requests, for the service receive * an answer that contains up to eight healthy records. *

*/ @ThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AWSServiceDiscoveryClient extends AmazonWebServiceClient implements AWSServiceDiscovery { /** Provider for AWS credentials. */ private final AWSCredentialsProvider awsCredentialsProvider; private static final Log log = LogFactory.getLog(AWSServiceDiscovery.class); /** Default signing name for the service. */ private static final String DEFAULT_SIGNING_NAME = "servicediscovery"; /** Client configuration factory providing ClientConfigurations tailored to this client */ protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); private final AdvancedConfig advancedConfig; private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory( new JsonClientMetadata() .withProtocolVersion("1.1") .withSupportsCbor(false) .withSupportsIon(false) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("OperationNotFound").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.OperationNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceInUse").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.ResourceInUseExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("DuplicateRequest").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.DuplicateRequestExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InvalidInput").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.InvalidInputExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceAlreadyExists").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.ServiceAlreadyExistsExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ServiceNotFound").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.ServiceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("NamespaceAlreadyExists").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.NamespaceAlreadyExistsExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("InstanceNotFound").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.InstanceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("NamespaceNotFound").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.NamespaceNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("CustomHealthNotFound").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.CustomHealthNotFoundExceptionUnmarshaller.getInstance())) .addErrorMetadata( new JsonErrorShapeMetadata().withErrorCode("ResourceLimitExceeded").withExceptionUnmarshaller( com.amazonaws.services.servicediscovery.model.transform.ResourceLimitExceededExceptionUnmarshaller.getInstance())) .withBaseServiceExceptionClass(com.amazonaws.services.servicediscovery.model.AWSServiceDiscoveryException.class)); public static AWSServiceDiscoveryClientBuilder builder() { return AWSServiceDiscoveryClientBuilder.standard(); } /** * Constructs a new client to invoke service methods on ServiceDiscovery using the specified parameters. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSServiceDiscoveryClient(AwsSyncClientParams clientParams) { this(clientParams, false); } /** * Constructs a new client to invoke service methods on ServiceDiscovery using the specified parameters. * *

* All service calls made using this new client object are blocking, and will not return until the service call * completes. * * @param clientParams * Object providing client parameters. */ AWSServiceDiscoveryClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) { super(clientParams); this.awsCredentialsProvider = clientParams.getCredentialsProvider(); this.advancedConfig = clientParams.getAdvancedConfig(); init(); } private void init() { setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("servicediscovery.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/servicediscovery/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/servicediscovery/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); } /** *

* Creates an HTTP namespace. Service instances that you register using an HTTP namespace can be discovered using a * DiscoverInstances request but can't be discovered using DNS. *

*

* For the current limit on the number of namespaces that you can create using the same AWS account, see AWS Cloud Map Limits in the * AWS Cloud Map Developer Guide. *

* * @param createHttpNamespaceRequest * @return Result of the CreateHttpNamespace operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws NamespaceAlreadyExistsException * The namespace that you're trying to create already exists. * @throws ResourceLimitExceededException * The resource can't be created because you've reached the limit on the number of resources. * @throws DuplicateRequestException * The operation is already in progress. * @sample AWSServiceDiscovery.CreateHttpNamespace * @see AWS API Documentation */ @Override public CreateHttpNamespaceResult createHttpNamespace(CreateHttpNamespaceRequest request) { request = beforeClientExecution(request); return executeCreateHttpNamespace(request); } @SdkInternalApi final CreateHttpNamespaceResult executeCreateHttpNamespace(CreateHttpNamespaceRequest createHttpNamespaceRequest) { ExecutionContext executionContext = createExecutionContext(createHttpNamespaceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new CreateHttpNamespaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createHttpNamespaceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateHttpNamespace"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateHttpNamespaceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Creates a private namespace based on DNS, which will be visible only inside a specified Amazon VPC. The namespace * defines your service naming scheme. For example, if you name your namespace example.com and name * your service backend, the resulting DNS name for the service will be * backend.example.com. For the current limit on the number of namespaces that you can create using the * same AWS account, see AWS Cloud * Map Limits in the AWS Cloud Map Developer Guide. *

* * @param createPrivateDnsNamespaceRequest * @return Result of the CreatePrivateDnsNamespace operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws NamespaceAlreadyExistsException * The namespace that you're trying to create already exists. * @throws ResourceLimitExceededException * The resource can't be created because you've reached the limit on the number of resources. * @throws DuplicateRequestException * The operation is already in progress. * @sample AWSServiceDiscovery.CreatePrivateDnsNamespace * @see AWS API Documentation */ @Override public CreatePrivateDnsNamespaceResult createPrivateDnsNamespace(CreatePrivateDnsNamespaceRequest request) { request = beforeClientExecution(request); return executeCreatePrivateDnsNamespace(request); } @SdkInternalApi final CreatePrivateDnsNamespaceResult executeCreatePrivateDnsNamespace(CreatePrivateDnsNamespaceRequest createPrivateDnsNamespaceRequest) { ExecutionContext executionContext = createExecutionContext(createPrivateDnsNamespaceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new CreatePrivateDnsNamespaceRequestProtocolMarshaller(protocolFactory).marshall(super .beforeMarshalling(createPrivateDnsNamespaceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePrivateDnsNamespace"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePrivateDnsNamespaceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Creates a public namespace based on DNS, which will be visible on the internet. The namespace defines your * service naming scheme. For example, if you name your namespace example.com and name your service * backend, the resulting DNS name for the service will be backend.example.com. For the * current limit on the number of namespaces that you can create using the same AWS account, see AWS Cloud Map Limits in the * AWS Cloud Map Developer Guide. *

* * @param createPublicDnsNamespaceRequest * @return Result of the CreatePublicDnsNamespace operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws NamespaceAlreadyExistsException * The namespace that you're trying to create already exists. * @throws ResourceLimitExceededException * The resource can't be created because you've reached the limit on the number of resources. * @throws DuplicateRequestException * The operation is already in progress. * @sample AWSServiceDiscovery.CreatePublicDnsNamespace * @see AWS API Documentation */ @Override public CreatePublicDnsNamespaceResult createPublicDnsNamespace(CreatePublicDnsNamespaceRequest request) { request = beforeClientExecution(request); return executeCreatePublicDnsNamespace(request); } @SdkInternalApi final CreatePublicDnsNamespaceResult executeCreatePublicDnsNamespace(CreatePublicDnsNamespaceRequest createPublicDnsNamespaceRequest) { ExecutionContext executionContext = createExecutionContext(createPublicDnsNamespaceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new CreatePublicDnsNamespaceRequestProtocolMarshaller(protocolFactory).marshall(super .beforeMarshalling(createPublicDnsNamespaceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePublicDnsNamespace"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePublicDnsNamespaceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Creates a service, which defines the configuration for the following entities: *

*
    *
  • *

    * For public and private DNS namespaces, one of the following combinations of DNS records in Amazon Route 53: *

    *
      *
    • *

      * A *

      *
    • *
    • *

      * AAAA *

      *
    • *
    • *

      * A and AAAA *

      *
    • *
    • *

      * SRV *

      *
    • *
    • *

      * CNAME *

      *
    • *
    *
  • *
  • *

    * Optionally, a health check *

    *
  • *
*

* After you create the service, you can submit a RegisterInstance request, and AWS Cloud Map uses the values * in the configuration to create the specified entities. *

*

* For the current limit on the number of instances that you can register using the same namespace and using the * same service, see AWS Cloud Map * Limits in the AWS Cloud Map Developer Guide. *

* * @param createServiceRequest * @return Result of the CreateService operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ResourceLimitExceededException * The resource can't be created because you've reached the limit on the number of resources. * @throws NamespaceNotFoundException * No namespace exists with the specified ID. * @throws ServiceAlreadyExistsException * The service can't be created because a service with the same name already exists. * @sample AWSServiceDiscovery.CreateService * @see AWS * API Documentation */ @Override public CreateServiceResult createService(CreateServiceRequest request) { request = beforeClientExecution(request); return executeCreateService(request); } @SdkInternalApi final CreateServiceResult executeCreateService(CreateServiceRequest createServiceRequest) { ExecutionContext executionContext = createExecutionContext(createServiceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new CreateServiceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createServiceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateService"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateServiceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Deletes a namespace from the current account. If the namespace still contains one or more services, the request * fails. *

* * @param deleteNamespaceRequest * @return Result of the DeleteNamespace operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws NamespaceNotFoundException * No namespace exists with the specified ID. * @throws ResourceInUseException * The specified resource can't be deleted because it contains other resources. For example, you can't * delete a service that contains any instances. * @throws DuplicateRequestException * The operation is already in progress. * @sample AWSServiceDiscovery.DeleteNamespace * @see AWS API Documentation */ @Override public DeleteNamespaceResult deleteNamespace(DeleteNamespaceRequest request) { request = beforeClientExecution(request); return executeDeleteNamespace(request); } @SdkInternalApi final DeleteNamespaceResult executeDeleteNamespace(DeleteNamespaceRequest deleteNamespaceRequest) { ExecutionContext executionContext = createExecutionContext(deleteNamespaceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new DeleteNamespaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteNamespaceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteNamespace"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteNamespaceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Deletes a specified service. If the service still contains one or more registered instances, the request fails. *

* * @param deleteServiceRequest * @return Result of the DeleteService operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ServiceNotFoundException * No service exists with the specified ID. * @throws ResourceInUseException * The specified resource can't be deleted because it contains other resources. For example, you can't * delete a service that contains any instances. * @sample AWSServiceDiscovery.DeleteService * @see AWS * API Documentation */ @Override public DeleteServiceResult deleteService(DeleteServiceRequest request) { request = beforeClientExecution(request); return executeDeleteService(request); } @SdkInternalApi final DeleteServiceResult executeDeleteService(DeleteServiceRequest deleteServiceRequest) { ExecutionContext executionContext = createExecutionContext(deleteServiceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new DeleteServiceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteServiceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteService"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteServiceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Deletes the Amazon Route 53 DNS records and health check, if any, that AWS Cloud Map created for the specified * instance. *

* * @param deregisterInstanceRequest * @return Result of the DeregisterInstance operation returned by the service. * @throws DuplicateRequestException * The operation is already in progress. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws InstanceNotFoundException * No instance exists with the specified ID, or the instance was recently registered, and information about * the instance hasn't propagated yet. * @throws ResourceInUseException * The specified resource can't be deleted because it contains other resources. For example, you can't * delete a service that contains any instances. * @throws ServiceNotFoundException * No service exists with the specified ID. * @sample AWSServiceDiscovery.DeregisterInstance * @see AWS API Documentation */ @Override public DeregisterInstanceResult deregisterInstance(DeregisterInstanceRequest request) { request = beforeClientExecution(request); return executeDeregisterInstance(request); } @SdkInternalApi final DeregisterInstanceResult executeDeregisterInstance(DeregisterInstanceRequest deregisterInstanceRequest) { ExecutionContext executionContext = createExecutionContext(deregisterInstanceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new DeregisterInstanceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deregisterInstanceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeregisterInstance"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeregisterInstanceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Discovers registered instances for a specified namespace and service. *

* * @param discoverInstancesRequest * @return Result of the DiscoverInstances operation returned by the service. * @throws ServiceNotFoundException * No service exists with the specified ID. * @throws NamespaceNotFoundException * No namespace exists with the specified ID. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @sample AWSServiceDiscovery.DiscoverInstances * @see AWS API Documentation */ @Override public DiscoverInstancesResult discoverInstances(DiscoverInstancesRequest request) { request = beforeClientExecution(request); return executeDiscoverInstances(request); } @SdkInternalApi final DiscoverInstancesResult executeDiscoverInstances(DiscoverInstancesRequest discoverInstancesRequest) { ExecutionContext executionContext = createExecutionContext(discoverInstancesRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new DiscoverInstancesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(discoverInstancesRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DiscoverInstances"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } URI endpointTraitHost = null; if (!clientConfiguration.isDisableHostPrefixInjection()) { String hostPrefix = "data-"; String resolvedHostPrefix = String.format("data-"); endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DiscoverInstancesResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext, null, endpointTraitHost); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Gets information about a specified instance. *

* * @param getInstanceRequest * @return Result of the GetInstance operation returned by the service. * @throws InstanceNotFoundException * No instance exists with the specified ID, or the instance was recently registered, and information about * the instance hasn't propagated yet. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ServiceNotFoundException * No service exists with the specified ID. * @sample AWSServiceDiscovery.GetInstance * @see AWS * API Documentation */ @Override public GetInstanceResult getInstance(GetInstanceRequest request) { request = beforeClientExecution(request); return executeGetInstance(request); } @SdkInternalApi final GetInstanceResult executeGetInstance(GetInstanceRequest getInstanceRequest) { ExecutionContext executionContext = createExecutionContext(getInstanceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetInstanceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getInstanceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetInstance"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetInstanceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Gets the current health status (Healthy, Unhealthy, or Unknown) of one or * more instances that are associated with a specified service. *

* *

* There is a brief delay between when you register an instance and when the health status for the instance is * available. *

*
* * @param getInstancesHealthStatusRequest * @return Result of the GetInstancesHealthStatus operation returned by the service. * @throws InstanceNotFoundException * No instance exists with the specified ID, or the instance was recently registered, and information about * the instance hasn't propagated yet. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ServiceNotFoundException * No service exists with the specified ID. * @sample AWSServiceDiscovery.GetInstancesHealthStatus * @see AWS API Documentation */ @Override public GetInstancesHealthStatusResult getInstancesHealthStatus(GetInstancesHealthStatusRequest request) { request = beforeClientExecution(request); return executeGetInstancesHealthStatus(request); } @SdkInternalApi final GetInstancesHealthStatusResult executeGetInstancesHealthStatus(GetInstancesHealthStatusRequest getInstancesHealthStatusRequest) { ExecutionContext executionContext = createExecutionContext(getInstancesHealthStatusRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetInstancesHealthStatusRequestProtocolMarshaller(protocolFactory).marshall(super .beforeMarshalling(getInstancesHealthStatusRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetInstancesHealthStatus"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetInstancesHealthStatusResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Gets information about a namespace. *

* * @param getNamespaceRequest * @return Result of the GetNamespace operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws NamespaceNotFoundException * No namespace exists with the specified ID. * @sample AWSServiceDiscovery.GetNamespace * @see AWS * API Documentation */ @Override public GetNamespaceResult getNamespace(GetNamespaceRequest request) { request = beforeClientExecution(request); return executeGetNamespace(request); } @SdkInternalApi final GetNamespaceResult executeGetNamespace(GetNamespaceRequest getNamespaceRequest) { ExecutionContext executionContext = createExecutionContext(getNamespaceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetNamespaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getNamespaceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetNamespace"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetNamespaceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Gets information about any operation that returns an operation ID in the response, such as a * CreateService request. *

* *

* To get a list of operations that match specified criteria, see ListOperations. *

*
* * @param getOperationRequest * @return Result of the GetOperation operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws OperationNotFoundException * No operation exists with the specified ID. * @sample AWSServiceDiscovery.GetOperation * @see AWS * API Documentation */ @Override public GetOperationResult getOperation(GetOperationRequest request) { request = beforeClientExecution(request); return executeGetOperation(request); } @SdkInternalApi final GetOperationResult executeGetOperation(GetOperationRequest getOperationRequest) { ExecutionContext executionContext = createExecutionContext(getOperationRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetOperationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getOperationRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetOperation"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetOperationResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Gets the settings for a specified service. *

* * @param getServiceRequest * @return Result of the GetService operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ServiceNotFoundException * No service exists with the specified ID. * @sample AWSServiceDiscovery.GetService * @see AWS * API Documentation */ @Override public GetServiceResult getService(GetServiceRequest request) { request = beforeClientExecution(request); return executeGetService(request); } @SdkInternalApi final GetServiceResult executeGetService(GetServiceRequest getServiceRequest) { ExecutionContext executionContext = createExecutionContext(getServiceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new GetServiceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getServiceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetService"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata() .withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetServiceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Lists summary information about the instances that you registered by using a specified service. *

* * @param listInstancesRequest * @return Result of the ListInstances operation returned by the service. * @throws ServiceNotFoundException * No service exists with the specified ID. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @sample AWSServiceDiscovery.ListInstances * @see AWS * API Documentation */ @Override public ListInstancesResult listInstances(ListInstancesRequest request) { request = beforeClientExecution(request); return executeListInstances(request); } @SdkInternalApi final ListInstancesResult executeListInstances(ListInstancesRequest listInstancesRequest) { ExecutionContext executionContext = createExecutionContext(listInstancesRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new ListInstancesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listInstancesRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListInstances"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListInstancesResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Lists summary information about the namespaces that were created by the current AWS account. *

* * @param listNamespacesRequest * @return Result of the ListNamespaces operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @sample AWSServiceDiscovery.ListNamespaces * @see AWS API Documentation */ @Override public ListNamespacesResult listNamespaces(ListNamespacesRequest request) { request = beforeClientExecution(request); return executeListNamespaces(request); } @SdkInternalApi final ListNamespacesResult executeListNamespaces(ListNamespacesRequest listNamespacesRequest) { ExecutionContext executionContext = createExecutionContext(listNamespacesRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new ListNamespacesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listNamespacesRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListNamespaces"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListNamespacesResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Lists operations that match the criteria that you specify. *

* * @param listOperationsRequest * @return Result of the ListOperations operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @sample AWSServiceDiscovery.ListOperations * @see AWS API Documentation */ @Override public ListOperationsResult listOperations(ListOperationsRequest request) { request = beforeClientExecution(request); return executeListOperations(request); } @SdkInternalApi final ListOperationsResult executeListOperations(ListOperationsRequest listOperationsRequest) { ExecutionContext executionContext = createExecutionContext(listOperationsRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new ListOperationsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listOperationsRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListOperations"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListOperationsResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Lists summary information for all the services that are associated with one or more specified namespaces. *

* * @param listServicesRequest * @return Result of the ListServices operation returned by the service. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @sample AWSServiceDiscovery.ListServices * @see AWS * API Documentation */ @Override public ListServicesResult listServices(ListServicesRequest request) { request = beforeClientExecution(request); return executeListServices(request); } @SdkInternalApi final ListServicesResult executeListServices(ListServicesRequest listServicesRequest) { ExecutionContext executionContext = createExecutionContext(listServicesRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new ListServicesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listServicesRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListServices"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListServicesResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Creates or updates one or more records and, optionally, creates a health check based on the settings in a * specified service. When you submit a RegisterInstance request, the following occurs: *

*
    *
  • *

    * For each DNS record that you define in the service that is specified by ServiceId, a record is * created or updated in the hosted zone that is associated with the corresponding namespace. *

    *
  • *
  • *

    * If the service includes HealthCheckConfig, a health check is created based on the settings in the * health check configuration. *

    *
  • *
  • *

    * The health check, if any, is associated with each of the new or updated records. *

    *
  • *
* *

* One RegisterInstance request must complete before you can submit another request and specify the * same service ID and instance ID. *

*
*

* For more information, see CreateService. *

*

* When AWS Cloud Map receives a DNS query for the specified DNS name, it returns the applicable value: *

*
    *
  • *

    * If the health check is healthy: returns all the records *

    *
  • *
  • *

    * If the health check is unhealthy: returns the applicable value for the last healthy instance *

    *
  • *
  • *

    * If you didn't specify a health check configuration: returns all the records *

    *
  • *
*

* For the current limit on the number of instances that you can register using the same namespace and using the * same service, see AWS Cloud Map * Limits in the AWS Cloud Map Developer Guide. *

* * @param registerInstanceRequest * @return Result of the RegisterInstance operation returned by the service. * @throws DuplicateRequestException * The operation is already in progress. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ResourceInUseException * The specified resource can't be deleted because it contains other resources. For example, you can't * delete a service that contains any instances. * @throws ResourceLimitExceededException * The resource can't be created because you've reached the limit on the number of resources. * @throws ServiceNotFoundException * No service exists with the specified ID. * @sample AWSServiceDiscovery.RegisterInstance * @see AWS API Documentation */ @Override public RegisterInstanceResult registerInstance(RegisterInstanceRequest request) { request = beforeClientExecution(request); return executeRegisterInstance(request); } @SdkInternalApi final RegisterInstanceResult executeRegisterInstance(RegisterInstanceRequest registerInstanceRequest) { ExecutionContext executionContext = createExecutionContext(registerInstanceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new RegisterInstanceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(registerInstanceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RegisterInstance"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RegisterInstanceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Submits a request to change the health status of a custom health check to healthy or unhealthy. *

*

* You can use UpdateInstanceCustomHealthStatus to change the status only for custom health checks, * which you define using HealthCheckCustomConfig when you create a service. You can't use it to change * the status for Route 53 health checks, which you define using HealthCheckConfig. *

*

* For more information, see HealthCheckCustomConfig. *

* * @param updateInstanceCustomHealthStatusRequest * @return Result of the UpdateInstanceCustomHealthStatus operation returned by the service. * @throws InstanceNotFoundException * No instance exists with the specified ID, or the instance was recently registered, and information about * the instance hasn't propagated yet. * @throws ServiceNotFoundException * No service exists with the specified ID. * @throws CustomHealthNotFoundException * The health check for the instance that is specified by ServiceId and InstanceId * is not a custom health check. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @sample AWSServiceDiscovery.UpdateInstanceCustomHealthStatus * @see AWS API Documentation */ @Override public UpdateInstanceCustomHealthStatusResult updateInstanceCustomHealthStatus(UpdateInstanceCustomHealthStatusRequest request) { request = beforeClientExecution(request); return executeUpdateInstanceCustomHealthStatus(request); } @SdkInternalApi final UpdateInstanceCustomHealthStatusResult executeUpdateInstanceCustomHealthStatus( UpdateInstanceCustomHealthStatusRequest updateInstanceCustomHealthStatusRequest) { ExecutionContext executionContext = createExecutionContext(updateInstanceCustomHealthStatusRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new UpdateInstanceCustomHealthStatusRequestProtocolMarshaller(protocolFactory).marshall(super .beforeMarshalling(updateInstanceCustomHealthStatusRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateInstanceCustomHealthStatus"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateInstanceCustomHealthStatusResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** *

* Submits a request to perform the following operations: *

*
    *
  • *

    * Add or delete DnsRecords configurations *

    *
  • *
  • *

    * Update the TTL setting for existing DnsRecords configurations *

    *
  • *
  • *

    * Add, update, or delete HealthCheckConfig for a specified service *

    *
  • *
*

* For public and private DNS namespaces, you must specify all DnsRecords configurations (and, * optionally, HealthCheckConfig) that you want to appear in the updated service. Any current * configurations that don't appear in an UpdateService request are deleted. *

*

* When you update the TTL setting for a service, AWS Cloud Map also updates the corresponding settings in all the * records and health checks that were created by using the specified service. *

* * @param updateServiceRequest * @return Result of the UpdateService operation returned by the service. * @throws DuplicateRequestException * The operation is already in progress. * @throws InvalidInputException * One or more specified values aren't valid. For example, a required value might be missing, a numeric * value might be outside the allowed range, or a string value might exceed length constraints. * @throws ServiceNotFoundException * No service exists with the specified ID. * @sample AWSServiceDiscovery.UpdateService * @see AWS * API Documentation */ @Override public UpdateServiceResult updateService(UpdateServiceRequest request) { request = beforeClientExecution(request); return executeUpdateService(request); } @SdkInternalApi final UpdateServiceResult executeUpdateService(UpdateServiceRequest updateServiceRequest) { ExecutionContext executionContext = createExecutionContext(updateServiceRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); awsRequestMetrics.startEvent(Field.ClientExecuteTime); Request request = null; Response response = null; try { awsRequestMetrics.startEvent(Field.RequestMarshallTime); try { request = new UpdateServiceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateServiceRequest)); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion()); request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ServiceDiscovery"); request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateService"); request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); } finally { awsRequestMetrics.endEvent(Field.RequestMarshallTime); } HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler( new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateServiceResultJsonUnmarshaller()); response = invoke(request, responseHandler, executionContext); return response.getAwsResponse(); } finally { endClientExecution(awsRequestMetrics, request, response); } } /** * Returns additional metadata for a previously executed successful, request, typically used for debugging issues * where a service isn't acting as expected. This data isn't considered part of the result data returned by an * operation, so it's available through this separate, diagnostic interface. *

* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic * information for an executed request, you should use this method to retrieve it as soon as possible after * executing the request. * * @param request * The originally executed request * * @return The response metadata for the specified request, or null if none is available. */ public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return client.getResponseMetadataForRequest(request); } /** * Normal invoke with authentication. Credentials are required and may be overriden at the request level. **/ private Response invoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext) { return invoke(request, responseHandler, executionContext, null, null); } /** * Normal invoke with authentication. Credentials are required and may be overriden at the request level. **/ private Response invoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) { executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider)); return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait); } /** * Invoke with no authentication. Credentials are not required and any credentials set on the client or request will * be ignored for this operation. **/ private Response anonymousInvoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext) { return doInvoke(request, responseHandler, executionContext, null, null); } /** * Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the * ExecutionContext beforehand. **/ private Response doInvoke(Request request, HttpResponseHandler> responseHandler, ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) { if (discoveredEndpoint != null) { request.setEndpoint(discoveredEndpoint); request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery"); } else if (uriFromEndpointTrait != null) { request.setEndpoint(uriFromEndpointTrait); } else { request.setEndpoint(endpoint); } request.setTimeOffset(timeOffset); HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata()); return client.execute(request, responseHandler, errorResponseHandler, executionContext); } @com.amazonaws.annotation.SdkInternalApi static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() { return protocolFactory; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy