Search in sources :

Example 1 with CreateServiceRequest

use of com.amazonaws.services.servicediscovery.model.CreateServiceRequest in project aws-doc-sdk-examples by awsdocs.

the class CreateService method main.

public static void main(String[] args) throws Exception {
    AWSCredentials credentials = null;
    try {
        credentials = new ProfileCredentialsProvider().getCredentials();
    } catch (Exception e) {
        throw new AmazonClientException("Cannot Load credentials");
    }
    AWSServiceDiscovery client = AWSServiceDiscoveryClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion("us-east-1").build();
    CreateServiceRequest crequest = new CreateServiceRequest();
    crequest.setName("example-service-01");
    crequest.setDescription("This is an example service request");
    // Replace with the namespaceID
    crequest.setNamespaceId("ns-ldmexc5fqajjnhco");
    System.out.println(client.createService(crequest));
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) CreateServiceRequest(com.amazonaws.services.servicediscovery.model.CreateServiceRequest) AWSServiceDiscovery(com.amazonaws.services.servicediscovery.AWSServiceDiscovery) AmazonClientException(com.amazonaws.AmazonClientException) ProfileCredentialsProvider(com.amazonaws.auth.profile.ProfileCredentialsProvider) AWSCredentials(com.amazonaws.auth.AWSCredentials) AmazonClientException(com.amazonaws.AmazonClientException)

Aggregations

AmazonClientException (com.amazonaws.AmazonClientException)1 AWSCredentials (com.amazonaws.auth.AWSCredentials)1 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)1 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)1 AWSServiceDiscovery (com.amazonaws.services.servicediscovery.AWSServiceDiscovery)1 CreateServiceRequest (com.amazonaws.services.servicediscovery.model.CreateServiceRequest)1