AWSService

public protocol AWSService

Protocol for services objects. Contains a client to communicate with AWS and config for defining how to communicate

  • Client used to communicate with AWS

    Declaration

    Swift

    var client: AWSClient { get }
  • Service context details

    Declaration

    Swift

    var config: AWSServiceConfig { get }
  • Patch initialization

    Declaration

    Swift

    init(from: Self, patch: AWSServiceConfig.Patch)
  • region Extension method

    Region where service is running

    Declaration

    Swift

    public var region: Region { get }
  • endpoint Extension method

    The url to use in requests

    Declaration

    Swift

    public var endpoint: String { get }
  • eventLoopGroup Extension method

    The EventLoopGroup service is using

    Declaration

    Swift

    public var eventLoopGroup: EventLoopGroup { get }
  • Generate a signed URL

    Declaration

    Swift

    public func signURL(
        url: URL,
        httpMethod: HTTPMethod,
        headers: HTTPHeaders = HTTPHeaders(),
        expires: TimeAmount,
        logger: Logger = AWSClient.loggingDisabled
    ) -> EventLoopFuture<URL>

    Parameters

    url

    URL to sign

    httpMethod

    HTTP method to use (.GET, .PUT, .PUSH etc)

    headers

    Headers that are to be used with this URL. Be sure to include these headers when you used the returned URL

    expires

    How long before the signed URL expires

    logger

    Logger to output to

    Return Value

    A signed URL

  • Generate signed headers

    Declaration

    Swift

    public func signHeaders(
        url: URL,
        httpMethod: HTTPMethod,
        headers: HTTPHeaders = HTTPHeaders(),
        body: AWSPayload = .empty,
        logger: Logger = AWSClient.loggingDisabled
    ) -> EventLoopFuture<HTTPHeaders>

    Parameters

    url

    URL to sign

    httpMethod

    HTTP method to use (.GET, .PUT, .PUSH etc)

    headers

    Headers that are to be used with this URL. Be sure to include these headers when you used the returned URL

    body

    body payload to sign as well. While it is unnecessary to provide the body for S3 other services require it

    logger

    Logger to output to

    Return Value

    A series of signed headers including the original headers provided to the function

  • Return new version of Service with edited parameters

    Declaration

    Swift

    public func with(
        middlewares: [AWSServiceMiddleware] = [],
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator? = nil,
        options: AWSServiceConfig.Options? = nil
    ) -> Self

    Parameters

    middlewares

    Additional middleware to add

    timeout

    Time out value for HTTP requests

    byteBufferAllocator

    byte buffer allocator used throughout AWSClient

    options

    options used by client when processing requests

    Return Value

    New version of the service

  • Return new version of Service with edited parameters

    Declaration

    Swift

    public func with(
        region: Region,
        middlewares: [AWSServiceMiddleware] = [],
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator? = nil,
        options: AWSServiceConfig.Options? = nil
    ) -> Self

    Parameters

    region

    Server region

    middlewares

    Additional middleware to add

    timeout

    Time out value for HTTP requests

    byteBufferAllocator

    byte buffer allocator used throughout AWSClient

    options

    options used by client when processing requests

    Return Value

    New version of the service

  • signURL(url:httpMethod:headers:expires:logger:) Extension method, asynchronous

    Generate a signed URL

    Declaration

    Swift

    public func signURL(
        url: URL,
        httpMethod: HTTPMethod,
        headers: HTTPHeaders = HTTPHeaders(),
        expires: TimeAmount,
        logger: Logger = AWSClient.loggingDisabled
    ) async throws -> URL

    Parameters

    url

    URL to sign

    httpMethod

    HTTP method to use (.GET, .PUT, .PUSH etc)

    headers

    Headers that are to be used with this URL. Be sure to include these headers when you used the returned URL

    expires

    How long before the signed URL expires

    logger

    Logger to output to

    Return Value

    A signed URL

  • signHeaders(url:httpMethod:headers:body:logger:) Extension method, asynchronous

    Generate signed headers

    Declaration

    Swift

    public func signHeaders(
        url: URL,
        httpMethod: HTTPMethod,
        headers: HTTPHeaders = HTTPHeaders(),
        body: AWSPayload = .empty,
        logger: Logger = AWSClient.loggingDisabled
    ) async throws -> HTTPHeaders

    Parameters

    url

    URL to sign

    httpMethod

    HTTP method to use (.GET, .PUT, .PUSH etc)

    headers

    Headers that are to be used with this URL. Be sure to include these headers when you used the returned URL

    body

    body payload to sign as well. While it is unnecessary to provide the body for S3 other services require it

    logger

    Logger to output to

    Return Value

    A series of signed headers including the original headers provided to the function