//===----------------------------------------------------------------------===//
//
// This source file is part of the AWSSDKSwift open source project
//
// Copyright (c) 2017-2020 the AWSSDKSwift project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of AWSSDKSwift project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/swift-aws/aws-sdk-swift/blob/master/CodeGenerator/Sources/CodeGenerator/main.swift. DO NOT EDIT.

@_exported import AWSSDKSwiftCore
import NIO

/**
Client object for interacting with AWS LicenseManager service.

 AWS License Manager  AWS License Manager makes it easier to manage licenses from software vendors across multiple AWS accounts and on-premises servers.
*/
public struct LicenseManager {

    //MARK: Member variables

    public let client: AWSClient

    //MARK: Initialization

    /// Initialize the LicenseManager client
    /// - parameters:
    ///     - accessKeyId: Public access key provided by AWS
    ///     - secretAccessKey: Private access key provided by AWS
    ///     - sessionToken: Token provided by STS.AssumeRole() which allows access to another AWS account
    ///     - region: Region of server you want to communicate with
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middlewares: Array of middlewares to apply to requests and responses
    ///     - httpClientProvider: HTTPClient to use. Use `createNew` if the client should manage its own HTTPClient.
    public init(
        accessKeyId: String? = nil,
        secretAccessKey: String? = nil,
        sessionToken: String? = nil,
        region: AWSSDKSwiftCore.Region? = nil,
        endpoint: String? = nil,
        middlewares: [AWSServiceMiddleware] = [],
        httpClientProvider: AWSClient.HTTPClientProvider = .createNew
    ) {
        self.client = AWSClient(
            accessKeyId: accessKeyId,
            secretAccessKey: secretAccessKey,
            sessionToken: sessionToken,
            region: region,
            partition: region?.partition ?? .aws,
            amzTarget: "AWSLicenseManager",
            service: "license-manager",
            serviceProtocol: .json(version: "1.1"),
            apiVersion: "2018-08-01",
            endpoint: endpoint,
            middlewares: middlewares,
            possibleErrorTypes: [LicenseManagerErrorType.self],
            httpClientProvider: httpClientProvider
        )
    }
    
    //MARK: API Calls

    ///  Creates a license configuration. A license configuration is an abstraction of a customer license agreement that can be consumed and enforced by License Manager. Components include specifications for the license type (licensing by instance, socket, CPU, or vCPU), allowed tenancy (shared tenancy, Dedicated Instance, Dedicated Host, or all of these), host affinity (how long a VM must be associated with a host), and the number of licenses purchased and used.
    public func createLicenseConfiguration(_ input: CreateLicenseConfigurationRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<CreateLicenseConfigurationResponse> {
        return client.send(operation: "CreateLicenseConfiguration", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Deletes the specified license configuration. You cannot delete a license configuration that is in use.
    public func deleteLicenseConfiguration(_ input: DeleteLicenseConfigurationRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<DeleteLicenseConfigurationResponse> {
        return client.send(operation: "DeleteLicenseConfiguration", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Gets detailed information about the specified license configuration.
    public func getLicenseConfiguration(_ input: GetLicenseConfigurationRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetLicenseConfigurationResponse> {
        return client.send(operation: "GetLicenseConfiguration", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Gets the License Manager settings for the current Region.
    public func getServiceSettings(_ input: GetServiceSettingsRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<GetServiceSettingsResponse> {
        return client.send(operation: "GetServiceSettings", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Lists the resource associations for the specified license configuration. Resource associations need not consume licenses from a license configuration. For example, an AMI or a stopped instance might not consume a license (depending on the license rules).
    public func listAssociationsForLicenseConfiguration(_ input: ListAssociationsForLicenseConfigurationRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListAssociationsForLicenseConfigurationResponse> {
        return client.send(operation: "ListAssociationsForLicenseConfiguration", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Lists the license configuration operations that failed.
    public func listFailuresForLicenseConfigurationOperations(_ input: ListFailuresForLicenseConfigurationOperationsRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListFailuresForLicenseConfigurationOperationsResponse> {
        return client.send(operation: "ListFailuresForLicenseConfigurationOperations", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Lists the license configurations for your account.
    public func listLicenseConfigurations(_ input: ListLicenseConfigurationsRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListLicenseConfigurationsResponse> {
        return client.send(operation: "ListLicenseConfigurations", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Describes the license configurations for the specified resource.
    public func listLicenseSpecificationsForResource(_ input: ListLicenseSpecificationsForResourceRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListLicenseSpecificationsForResourceResponse> {
        return client.send(operation: "ListLicenseSpecificationsForResource", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Lists resources managed using Systems Manager inventory.
    public func listResourceInventory(_ input: ListResourceInventoryRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListResourceInventoryResponse> {
        return client.send(operation: "ListResourceInventory", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Lists the tags for the specified license configuration.
    public func listTagsForResource(_ input: ListTagsForResourceRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListTagsForResourceResponse> {
        return client.send(operation: "ListTagsForResource", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Lists all license usage records for a license configuration, displaying license consumption details by resource at a selected point in time. Use this action to audit the current license consumption for any license inventory and configuration.
    public func listUsageForLicenseConfiguration(_ input: ListUsageForLicenseConfigurationRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<ListUsageForLicenseConfigurationResponse> {
        return client.send(operation: "ListUsageForLicenseConfiguration", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Adds the specified tags to the specified license configuration.
    public func tagResource(_ input: TagResourceRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<TagResourceResponse> {
        return client.send(operation: "TagResource", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Removes the specified tags from the specified license configuration.
    public func untagResource(_ input: UntagResourceRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UntagResourceResponse> {
        return client.send(operation: "UntagResource", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Modifies the attributes of an existing license configuration. A license configuration is an abstraction of a customer license agreement that can be consumed and enforced by License Manager. Components include specifications for the license type (licensing by instance, socket, CPU, or vCPU), allowed tenancy (shared tenancy, Dedicated Instance, Dedicated Host, or all of these), host affinity (how long a VM must be associated with a host), and the number of licenses purchased and used.
    public func updateLicenseConfiguration(_ input: UpdateLicenseConfigurationRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdateLicenseConfigurationResponse> {
        return client.send(operation: "UpdateLicenseConfiguration", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Adds or removes the specified license configurations for the specified AWS resource. You can update the license specifications of AMIs, instances, and hosts. You cannot update the license specifications for launch templates and AWS CloudFormation templates, as they send license configurations to the operation that creates the resource.
    public func updateLicenseSpecificationsForResource(_ input: UpdateLicenseSpecificationsForResourceRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdateLicenseSpecificationsForResourceResponse> {
        return client.send(operation: "UpdateLicenseSpecificationsForResource", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }

    ///  Updates License Manager settings for the current Region.
    public func updateServiceSettings(_ input: UpdateServiceSettingsRequest, on eventLoop: EventLoop? = nil) -> EventLoopFuture<UpdateServiceSettingsResponse> {
        return client.send(operation: "UpdateServiceSettings", path: "/", httpMethod: "POST", input: input, on: eventLoop)
    }
}
