public String createService(AWSServiceDiscovery serviceDiscovery, String name, String description, String namespaceId, Long ttl) {
        if (serviceDiscovery == null) {
            serviceDiscovery = AWSServiceDiscoveryClient.builder().withClientConfiguration(clientConfiguration.getClientConfiguration()).build();
        }
        DnsRecord dnsRecord = new DnsRecord().withType(RecordType.A).withTTL(ttl);
        DnsConfig dnsConfig = new DnsConfig().withDnsRecords(dnsRecord).withNamespaceId(namespaceId).withRoutingPolicy(RoutingPolicy.WEIGHTED);
        CreateServiceRequest createServiceRequest = new CreateServiceRequest().withDnsConfig(dnsConfig)
                .withDescription(description)
                .withName(name);
        CreateServiceResult servicerResult = serviceDiscovery.createService(createServiceRequest);
        Service createdService = servicerResult.getService();
        return createdService.getId();
    }
public String createService ( AWSServiceDiscovery serviceDiscovery , String name , String description , String namespaceId , Long ttl ) { if ( serviceDiscovery == null ) { serviceDiscovery = AWSServiceDiscoveryClient . builder ( ) . withClientConfiguration ( clientConfiguration . getClientConfiguration ( ) ) . build ( ) ; } DnsRecord dnsRecord = new DnsRecord ( ) . withType ( RecordType . A ) . withTTL ( ttl ) ; DnsConfig dnsConfig = new DnsConfig ( ) . withDnsRecords ( dnsRecord ) . withNamespaceId ( namespaceId ) . withRoutingPolicy ( RoutingPolicy . WEIGHTED ) ; CreateServiceRequest createServiceRequest = new CreateServiceRequest ( ) . withDnsConfig ( dnsConfig ) . withDescription ( description ) . withName ( name ) ; CreateServiceResult servicerResult = serviceDiscovery . createService ( createServiceRequest ) ; Service createdService = servicerResult . getService ( ) ; return createdService . getId ( ) ; }
Create service, helper for integration tests.
@param serviceDiscovery service discovery instance
@param name name of the service
@param description description of the service
@param namespaceId namespaceId to attach it to (get via cli or api call)
@param ttl time to live for checking pulse
@return serviceId