ServiceDiscovery
Service object for interacting with AWS ServiceDiscovery service.
public struct ServiceDiscovery: AWSService
With Cloud Map, you can configure public DNS, private DNS, or HTTP namespaces that your microservice applications run in. When an instance becomes available, you can call the Cloud Map API to register the instance with Cloud Map. For public or private DNS namespaces, 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.
Inheritance
AWSService
Initializers
init(client:region:partition:endpoint:timeout:byteBufferAllocator:options:)
Initialize the ServiceDiscovery client
public init(
client: AWSClient,
region: SotoCore.Region? = nil,
partition: AWSPartition = .aws,
endpoint: String? = nil,
timeout: TimeAmount? = nil,
byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
options: AWSServiceConfig.Options = []
)
Parameters
- client: AWSClient used to process requests
- region: Region of server you want to communicate with. This will override the partition parameter.
- partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
- endpoint: Custom endpoint URL to use instead of standard AWS servers
- timeout: Timeout value for HTTP requests
init(from:patch:)
Initializer required by AWSService.with(middlewares:timeout:byteBufferAllocator:options)
. You are not able to use this initializer directly as there are no public initializers for AWSServiceConfig.Patch
. Please use AWSService.with(middlewares:timeout:byteBufferAllocator:options)
instead.
public init(from: ServiceDiscovery, patch: AWSServiceConfig.Patch)
Properties
client
Client used for communication with AWS
public let client: AWSClient
config
Service configuration
public let config: AWSServiceConfig
Methods
createHttpNamespace(_:logger:on:)
public func createHttpNamespace(_ input: CreateHttpNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<CreateHttpNamespaceResponse>
Creates an HTTP namespace. Service instances registered using an HTTP namespace can be discovered using a
DiscoverInstances
request but can't be discovered using DNS.
For the current quota on the number of namespaces that you can create using the same account, see Cloud Map quotas in the Cloud Map Developer Guide.
createPrivateDnsNamespace(_:logger:on:)
public func createPrivateDnsNamespace(_ input: CreatePrivateDnsNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<CreatePrivateDnsNamespaceResponse>
Creates a private namespace based on DNS, which is 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 is backend.example.com
. Service
instances that are registered using a private DNS namespace can be discovered using either a
DiscoverInstances
request or using DNS. For the current quota on the number of namespaces that you can
create using the same account, see Cloud Map quotas in the
Cloud Map Developer Guide.
createPublicDnsNamespace(_:logger:on:)
public func createPublicDnsNamespace(_ input: CreatePublicDnsNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<CreatePublicDnsNamespaceResponse>
Creates a public namespace based on DNS, which is 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 is backend.example.com
. You can discover
instances that were registered with a public DNS namespace by using either a DiscoverInstances
request
or using DNS. For the current quota on the number of namespaces that you can create using the same account, see Cloud Map
quotas in the Cloud Map Developer Guide.
createService(_:logger:on:)
public func createService(_ input: CreateServiceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<CreateServiceResponse>
Creates a service. This action 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
andAAAA
-
SRV
-
CNAME
-
-
Optionally, a health check
After you create the service, you can submit a RegisterInstance request, and Cloud Map uses the values in the configuration to create the specified entities.
For the current quota on the number of instances that you can register using the same namespace and using the same service, see Cloud Map quotas in the Cloud Map Developer Guide.
deleteNamespace(_:logger:on:)
public func deleteNamespace(_ input: DeleteNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<DeleteNamespaceResponse>
Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails.
deleteService(_:logger:on:)
public func deleteService(_ input: DeleteServiceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<DeleteServiceResponse>
Deletes a specified service. If the service still contains one or more registered instances, the request fails.
deregisterInstance(_:logger:on:)
public func deregisterInstance(_ input: DeregisterInstanceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<DeregisterInstanceResponse>
Deletes the Amazon Route 53 DNS records and health check, if any, that Cloud Map created for the specified instance.
discoverInstances(_:logger:on:)
public func discoverInstances(_ input: DiscoverInstancesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<DiscoverInstancesResponse>
Discovers registered instances for a specified namespace and service. You can use DiscoverInstances
to discover instances for any type of namespace. For public and private DNS namespaces, you can also use DNS queries
to discover instances.
getInstance(_:logger:on:)
public func getInstance(_ input: GetInstanceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetInstanceResponse>
Gets information about a specified instance.
getInstancesHealthStatus(_:logger:on:)
public func getInstancesHealthStatus(_ input: GetInstancesHealthStatusRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetInstancesHealthStatusResponse>
Gets the current health status (Healthy
, Unhealthy
, or Unknown
) of one or
more instances that are associated with a specified service.
There's a brief delay between when you register an instance and when the health status for the instance is available.
getNamespace(_:logger:on:)
public func getNamespace(_ input: GetNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetNamespaceResponse>
Gets information about a namespace.
getOperation(_:logger:on:)
public func getOperation(_ input: GetOperationRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetOperationResponse>
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.
getService(_:logger:on:)
public func getService(_ input: GetServiceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetServiceResponse>
Gets the settings for a specified service.
listInstances(_:logger:on:)
public func listInstances(_ input: ListInstancesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListInstancesResponse>
Lists summary information about the instances that you registered by using a specified service.
listNamespaces(_:logger:on:)
public func listNamespaces(_ input: ListNamespacesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListNamespacesResponse>
Lists summary information about the namespaces that were created by the current account.
listOperations(_:logger:on:)
public func listOperations(_ input: ListOperationsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListOperationsResponse>
Lists operations that match the criteria that you specify.
listServices(_:logger:on:)
public func listServices(_ input: ListServicesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListServicesResponse>
Lists summary information for all the services that are associated with one or more specified namespaces.
listTagsForResource(_:logger:on:)
public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListTagsForResourceResponse>
Lists tags for the specified resource.
registerInstance(_:logger:on:)
public func registerInstance(_ input: RegisterInstanceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<RegisterInstanceResponse>
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's specified by
ServiceId
, a record is created or updated in the hosted zone that's 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 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 quota on the number of instances that you can register using the same namespace and using the same service, see Cloud Map quotas in the Cloud Map Developer Guide.
tagResource(_:logger:on:)
public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<TagResourceResponse>
Adds one or more tags to the specified resource.
untagResource(_:logger:on:)
public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UntagResourceResponse>
Removes one or more tags from the specified resource.
updateHttpNamespace(_:logger:on:)
public func updateHttpNamespace(_ input: UpdateHttpNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdateHttpNamespaceResponse>
Updates an HTTP namespace.
updateInstanceCustomHealthStatus(_:logger:on:)
@discardableResult public func updateInstanceCustomHealthStatus(_ input: UpdateInstanceCustomHealthStatusRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<Void>
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.
updatePrivateDnsNamespace(_:logger:on:)
public func updatePrivateDnsNamespace(_ input: UpdatePrivateDnsNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdatePrivateDnsNamespaceResponse>
Updates a private DNS namespace.
updatePublicDnsNamespace(_:logger:on:)
public func updatePublicDnsNamespace(_ input: UpdatePublicDnsNamespaceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdatePublicDnsNamespaceResponse>
Updates a public DNS namespace.
updateService(_:logger:on:)
public func updateService(_ input: UpdateServiceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdateServiceResponse>
Submits a request to perform the following operations:
-
Update the TTL setting for existing
DnsRecords
configurations -
Add, update, or delete
HealthCheckConfig
for a specified serviceYou can't add, update, or delete a
HealthCheckCustomConfig
configuration.
For public and private DNS namespaces, note the following:
-
If you omit any existing
DnsRecords
orHealthCheckConfig
configurations from anUpdateService
request, the configurations are deleted from the service. -
If you omit an existing
HealthCheckCustomConfig
configuration from anUpdateService
request, the configuration isn't deleted from the service.
When you update settings for a service, Cloud Map also updates the corresponding settings in all the records and health checks that were created by using the specified service.
getInstancesHealthStatusPaginator(_:logger:on:)
compiler(>=5.5.2) && canImport(_Concurrency)
public func getInstancesHealthStatusPaginator( _ input: GetInstancesHealthStatusRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil ) -> AWSClient.PaginatorSequence<GetInstancesHealthStatusRequest, GetInstancesHealthStatusResponse>
Gets the current health status (
Healthy
,Unhealthy
, orUnknown
) of one or more instances that are associated with a specified service.There's a brief delay between when you register an instance and when the health status for the instance is available.
listInstancesPaginator(_:logger:on:)
compiler(>=5.5.2) && canImport(_Concurrency)
public func listInstancesPaginator( _ input: ListInstancesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil ) -> AWSClient.PaginatorSequence<ListInstancesRequest, ListInstancesResponse>
Lists summary information about the instances that you registered by using a specified service.
Return PaginatorSequence for operation. - Parameters: - input: Input for request - logger: Logger used flot logging - eventLoop: EventLoop to run this process on
listNamespacesPaginator(_:logger:on:)
compiler(>=5.5.2) && canImport(_Concurrency)
public func listNamespacesPaginator( _ input: ListNamespacesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil ) -> AWSClient.PaginatorSequence<ListNamespacesRequest, ListNamespacesResponse>
Lists summary information about the namespaces that were created by the current account.
Return PaginatorSequence for operation. - Parameters: - input: Input for request - logger: Logger used flot logging - eventLoop: EventLoop to run this process on
listOperationsPaginator(_:logger:on:)
compiler(>=5.5.2) && canImport(_Concurrency)
public func listOperationsPaginator( _ input: ListOperationsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil ) -> AWSClient.PaginatorSequence<ListOperationsRequest, ListOperationsResponse>
Lists operations that match the criteria that you specify.
Return PaginatorSequence for operation. - Parameters: - input: Input for request - logger: Logger used flot logging - eventLoop: EventLoop to run this process on
listServicesPaginator(_:logger:on:)
compiler(>=5.5.2) && canImport(_Concurrency)
public func listServicesPaginator( _ input: ListServicesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil ) -> AWSClient.PaginatorSequence<ListServicesRequest, ListServicesResponse>
Lists summary information for all the services that are associated with one or more specified namespaces.
Return PaginatorSequence for operation. - Parameters: - input: Input for request - logger: Logger used flot logging - eventLoop: EventLoop to run this process on
getInstancesHealthStatusPaginator(_:_:logger:on:onPage:)
Provide paginated results to closure onPage
for it to combine them into one result. This works in a similar manner to Array.reduce<Result>(_:_:) -> Result
.
public func getInstancesHealthStatusPaginator<Result>(
_ input: GetInstancesHealthStatusRequest,
_ initialValue: Result,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (Result, GetInstancesHealthStatusResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
) -> EventLoopFuture<Result>
Gets the current health status (Healthy
, Unhealthy
, or Unknown
) of one or
more instances that are associated with a specified service.
There's a brief delay between when you register an instance and when the health status for the instance is available.
Parameters:
- input: Input for request
- initialValue: The value to use as the initial accumulating value.
initialValue
is passed toonPage
the first time it is called.
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned along with a boolean indicating if the paginate operation should continue.
getInstancesHealthStatusPaginator(_:logger:on:onPage:)
Provide paginated results to closure onPage
.
public func getInstancesHealthStatusPaginator(
_ input: GetInstancesHealthStatusRequest,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (GetInstancesHealthStatusResponse, EventLoop) -> EventLoopFuture<Bool>
) -> EventLoopFuture<Void>
Parameters
- input: Input for request
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
listInstancesPaginator(_:_:logger:on:onPage:)
Provide paginated results to closure onPage
for it to combine them into one result. This works in a similar manner to Array.reduce<Result>(_:_:) -> Result
.
public func listInstancesPaginator<Result>(
_ input: ListInstancesRequest,
_ initialValue: Result,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (Result, ListInstancesResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
) -> EventLoopFuture<Result>
Lists summary information about the instances that you registered by using a specified service.
Parameters:
- input: Input for request
- initialValue: The value to use as the initial accumulating value.
initialValue
is passed toonPage
the first time it is called.
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned along with a boolean indicating if the paginate operation should continue.
listInstancesPaginator(_:logger:on:onPage:)
Provide paginated results to closure onPage
.
public func listInstancesPaginator(
_ input: ListInstancesRequest,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (ListInstancesResponse, EventLoop) -> EventLoopFuture<Bool>
) -> EventLoopFuture<Void>
Parameters
- input: Input for request
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
listNamespacesPaginator(_:_:logger:on:onPage:)
Provide paginated results to closure onPage
for it to combine them into one result. This works in a similar manner to Array.reduce<Result>(_:_:) -> Result
.
public func listNamespacesPaginator<Result>(
_ input: ListNamespacesRequest,
_ initialValue: Result,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (Result, ListNamespacesResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
) -> EventLoopFuture<Result>
Lists summary information about the namespaces that were created by the current account.
Parameters:
- input: Input for request
- initialValue: The value to use as the initial accumulating value.
initialValue
is passed toonPage
the first time it is called.
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned along with a boolean indicating if the paginate operation should continue.
listNamespacesPaginator(_:logger:on:onPage:)
Provide paginated results to closure onPage
.
public func listNamespacesPaginator(
_ input: ListNamespacesRequest,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (ListNamespacesResponse, EventLoop) -> EventLoopFuture<Bool>
) -> EventLoopFuture<Void>
Parameters
- input: Input for request
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
listOperationsPaginator(_:_:logger:on:onPage:)
Provide paginated results to closure onPage
for it to combine them into one result. This works in a similar manner to Array.reduce<Result>(_:_:) -> Result
.
public func listOperationsPaginator<Result>(
_ input: ListOperationsRequest,
_ initialValue: Result,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (Result, ListOperationsResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
) -> EventLoopFuture<Result>
Lists operations that match the criteria that you specify.
Parameters:
- input: Input for request
- initialValue: The value to use as the initial accumulating value.
initialValue
is passed toonPage
the first time it is called.
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned along with a boolean indicating if the paginate operation should continue.
listOperationsPaginator(_:logger:on:onPage:)
Provide paginated results to closure onPage
.
public func listOperationsPaginator(
_ input: ListOperationsRequest,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (ListOperationsResponse, EventLoop) -> EventLoopFuture<Bool>
) -> EventLoopFuture<Void>
Parameters
- input: Input for request
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.
listServicesPaginator(_:_:logger:on:onPage:)
Provide paginated results to closure onPage
for it to combine them into one result. This works in a similar manner to Array.reduce<Result>(_:_:) -> Result
.
public func listServicesPaginator<Result>(
_ input: ListServicesRequest,
_ initialValue: Result,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (Result, ListServicesResponse, EventLoop) -> EventLoopFuture<(Bool, Result)>
) -> EventLoopFuture<Result>
Lists summary information for all the services that are associated with one or more specified namespaces.
Parameters:
- input: Input for request
- initialValue: The value to use as the initial accumulating value.
initialValue
is passed toonPage
the first time it is called.
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each paginated response. It combines an accumulating result with the contents of response. This combined result is then returned along with a boolean indicating if the paginate operation should continue.
listServicesPaginator(_:logger:on:onPage:)
Provide paginated results to closure onPage
.
public func listServicesPaginator(
_ input: ListServicesRequest,
logger: Logger = AWSClient.loggingDisabled,
on eventLoop: EventLoop? = nil,
onPage: @escaping (ListServicesResponse, EventLoop) -> EventLoopFuture<Bool>
) -> EventLoopFuture<Void>
Parameters
- input: Input for request
- logger: Logger used flot logging
- eventLoop: EventLoop to run this process on
- onPage: closure called with each block of entries. Returns boolean indicating whether we should continue.