import Foundation
import azureSwiftRuntime
public protocol ApplicationPut  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var apiVersion : String { get set }
    var parameters :  ApplicationResourceProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Application {
// Put creates or updates an application resource with the specified name. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
    internal class PutCommand : BaseCommand, ApplicationPut {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ApplicationResourceProtocol?

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, parameters: ApplicationResourceProtocol) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ApplicationResourceData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ApplicationResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

// ApplicationType is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct ApplicationType {
    public static func Delete(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String) -> ApplicationTypeDelete {
        return DeleteCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName)
    }
    public static func Get(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String) -> ApplicationTypeGet {
        return GetCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName)
    }
    public static func List(subscriptionId: String, resourceGroupName: String, clusterName: String) -> ApplicationTypeList {
        return ListCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName)
    }
    public static func Put(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, parameters: ApplicationTypeResourceProtocol) -> ApplicationTypePut {
        return PutCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName, parameters: parameters)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationTypeDelete  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (Error?) -> Void) -> Void;
}

extension Commands.ApplicationType {
// Delete deletes the application type name resource. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
    internal class DeleteCommand : BaseCommand, ApplicationTypeDelete {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public func execute(client: RuntimeClient,
            completionHandler: @escaping (Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (error) in
                completionHandler(error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationTypeGet  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationTypeResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ApplicationType {
// Get returns an application type name resource.
    internal class GetCommand : BaseCommand, ApplicationTypeGet {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationTypeResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationTypeResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ApplicationTypeResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationTypeList  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationTypeResourceListProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ApplicationType {
// List returns all application type names in the specified cluster.
    internal class ListCommand : BaseCommand, ApplicationTypeList {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationTypeResourceListData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationTypeResourceListProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ApplicationTypeResourceListData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationTypePut  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var apiVersion : String { get set }
    var parameters :  ApplicationTypeResourceProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationTypeResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ApplicationType {
// Put creates the application type name resource.
    internal class PutCommand : BaseCommand, ApplicationTypePut {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ApplicationTypeResourceProtocol?

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, parameters: ApplicationTypeResourceProtocol) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ApplicationTypeResourceData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationTypeResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationTypeResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ApplicationTypeResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

// Clusters is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Clusters {
    public static func Create(resourceGroupName: String, clusterName: String, subscriptionId: String, parameters: ClusterProtocol) -> ClustersCreate {
        return CreateCommand(resourceGroupName: resourceGroupName, clusterName: clusterName, subscriptionId: subscriptionId, parameters: parameters)
    }
    public static func Delete(resourceGroupName: String, clusterName: String, subscriptionId: String) -> ClustersDelete {
        return DeleteCommand(resourceGroupName: resourceGroupName, clusterName: clusterName, subscriptionId: subscriptionId)
    }
    public static func Get(resourceGroupName: String, clusterName: String, subscriptionId: String) -> ClustersGet {
        return GetCommand(resourceGroupName: resourceGroupName, clusterName: clusterName, subscriptionId: subscriptionId)
    }
    public static func List(subscriptionId: String) -> ClustersList {
        return ListCommand(subscriptionId: subscriptionId)
    }
    public static func ListByResourceGroup(resourceGroupName: String, subscriptionId: String) -> ClustersListByResourceGroup {
        return ListByResourceGroupCommand(resourceGroupName: resourceGroupName, subscriptionId: subscriptionId)
    }
    public static func Update(resourceGroupName: String, clusterName: String, subscriptionId: String, parameters: ClusterUpdateParametersProtocol) -> ClustersUpdate {
        return UpdateCommand(resourceGroupName: resourceGroupName, clusterName: clusterName, subscriptionId: subscriptionId, parameters: parameters)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol ClustersCreate  {
    var headerParameters: [String: String] { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    var parameters :  ClusterProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Clusters {
// Create create cluster resource
// This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
    internal class CreateCommand : BaseCommand, ClustersCreate {
        public var resourceGroupName : String
        public var clusterName : String
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ClusterProtocol?

        public init(resourceGroupName: String, clusterName: String, subscriptionId: String, parameters: ClusterProtocol) {
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.subscriptionId = subscriptionId
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ClusterData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ClusterData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClustersDelete  {
    var headerParameters: [String: String] { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (Error?) -> Void) -> Void;
}

extension Commands.Clusters {
// Delete delete cluster resource
    internal class DeleteCommand : BaseCommand, ClustersDelete {
        public var resourceGroupName : String
        public var clusterName : String
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"

        public init(resourceGroupName: String, clusterName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public func execute(client: RuntimeClient,
            completionHandler: @escaping (Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (error) in
                completionHandler(error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClustersGet  {
    var headerParameters: [String: String] { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Clusters {
// Get get cluster resource
    internal class GetCommand : BaseCommand, ClustersGet {
        public var resourceGroupName : String
        public var clusterName : String
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"

        public init(resourceGroupName: String, clusterName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClustersList  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Clusters {
// List list cluster resource
    internal class ListCommand : BaseCommand, ClustersList {
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String) {
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterListResultData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterListResultProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClustersListByResourceGroup  {
    var headerParameters: [String: String] { get set }
    var resourceGroupName : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Clusters {
// ListByResourceGroup list cluster resource by resource group
    internal class ListByResourceGroupCommand : BaseCommand, ClustersListByResourceGroup {
        public var resourceGroupName : String
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"

        public init(resourceGroupName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterListResultData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterListResultProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClustersUpdate  {
    var headerParameters: [String: String] { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    var parameters :  ClusterUpdateParametersProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Clusters {
// Update update cluster configuration
// This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
    internal class UpdateCommand : BaseCommand, ClustersUpdate {
        public var resourceGroupName : String
        public var clusterName : String
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ClusterUpdateParametersProtocol?

        public init(resourceGroupName: String, clusterName: String, subscriptionId: String, parameters: ClusterUpdateParametersProtocol) {
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.subscriptionId = subscriptionId
            self.parameters = parameters
            super.init()
            self.method = "Patch"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ClusterUpdateParametersData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ClusterData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

// ClusterVersions is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct ClusterVersions {
    public static func Get(location: String, subscriptionId: String, clusterVersion: String) -> ClusterVersionsGet {
        return GetCommand(location: location, subscriptionId: subscriptionId, clusterVersion: clusterVersion)
    }
    public static func GetByEnvironment(location: String, environment: GetByEnvironmentEnvironmentEnum, subscriptionId: String, clusterVersion: String) -> ClusterVersionsGetByEnvironment {
        return GetByEnvironmentCommand(location: location, environment: environment, subscriptionId: subscriptionId, clusterVersion: clusterVersion)
    }
    public static func List(location: String, subscriptionId: String) -> ClusterVersionsList {
        return ListCommand(location: location, subscriptionId: subscriptionId)
    }
    public static func ListByEnvironment(location: String, environment: ListByEnvironmentEnvironmentEnum, subscriptionId: String) -> ClusterVersionsListByEnvironment {
        return ListByEnvironmentCommand(location: location, environment: environment, subscriptionId: subscriptionId)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol ClusterVersionsGet  {
    var headerParameters: [String: String] { get set }
    var location : String { get set }
    var subscriptionId : String { get set }
    var clusterVersion : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ClusterVersions {
// Get get cluster code versions by location
    internal class GetCommand : BaseCommand, ClusterVersionsGet {
        public var location : String
        public var subscriptionId : String
        public var clusterVersion : String
        public var apiVersion = "2017-07-01-preview"

        public init(location: String, subscriptionId: String, clusterVersion: String) {
            self.location = location
            self.subscriptionId = subscriptionId
            self.clusterVersion = clusterVersion
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{location}"] = String(describing: self.location)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{clusterVersion}"] = String(describing: self.clusterVersion)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterCodeVersionsListResultData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterCodeVersionsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClusterVersionsGetByEnvironment  {
    var headerParameters: [String: String] { get set }
    var location : String { get set }
    var environment : GetByEnvironmentEnvironmentEnum { get set }
    var subscriptionId : String { get set }
    var clusterVersion : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ClusterVersions {
// GetByEnvironment get cluster code versions by environment
    internal class GetByEnvironmentCommand : BaseCommand, ClusterVersionsGetByEnvironment {
        public var location : String
        public var environment : GetByEnvironmentEnvironmentEnum
        public var subscriptionId : String
        public var clusterVersion : String
        public var apiVersion = "2017-07-01-preview"

        public init(location: String, environment: GetByEnvironmentEnvironmentEnum, subscriptionId: String, clusterVersion: String) {
            self.location = location
            self.environment = environment
            self.subscriptionId = subscriptionId
            self.clusterVersion = clusterVersion
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{location}"] = String(describing: self.location)
            self.pathParameters["{environment}"] = String(describing: self.environment)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{clusterVersion}"] = String(describing: self.clusterVersion)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterCodeVersionsListResultData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterCodeVersionsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClusterVersionsList  {
    var headerParameters: [String: String] { get set }
    var location : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ClusterVersions {
// List list cluster code versions by location
    internal class ListCommand : BaseCommand, ClusterVersionsList {
        public var location : String
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"

        public init(location: String, subscriptionId: String) {
            self.location = location
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{location}"] = String(describing: self.location)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterCodeVersionsListResultData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterCodeVersionsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ClusterVersionsListByEnvironment  {
    var headerParameters: [String: String] { get set }
    var location : String { get set }
    var environment : ListByEnvironmentEnvironmentEnum { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ClusterVersions {
// ListByEnvironment list cluster code versions by environment
    internal class ListByEnvironmentCommand : BaseCommand, ClusterVersionsListByEnvironment {
        public var location : String
        public var environment : ListByEnvironmentEnvironmentEnum
        public var subscriptionId : String
        public var apiVersion = "2017-07-01-preview"

        public init(location: String, environment: ListByEnvironmentEnvironmentEnum, subscriptionId: String) {
            self.location = location
            self.environment = environment
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{location}"] = String(describing: self.location)
            self.pathParameters["{environment}"] = String(describing: self.environment)
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ClusterCodeVersionsListResultData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ClusterCodeVersionsListResultProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ClusterCodeVersionsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public class DataFactory {
}
public class Commands {
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

// Operations is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Operations {
    public static func List() -> OperationsList {
        return ListCommand()
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol OperationsList  {
    var nextLink: String? { get }
    var hasAdditionalPages : Bool { get }
    var headerParameters: [String: String] { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (OperationListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Operations {
// List sends the list request.
    internal class ListCommand : BaseCommand, OperationsList {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var apiVersion = "2017-07-01-preview"

    public override init() {
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/providers/Microsoft.ServiceFabric/operations"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(OperationListResultData?.self, from: data)
                if var pageDecoder = decoder as? PageDecoder {
                    self.nextLink = pageDecoder.nextLink
                }
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (OperationListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: OperationListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

// Service is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Service {
    public static func Delete(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String) -> ServiceDelete {
        return DeleteCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName, serviceName: serviceName)
    }
    public static func Get(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String) -> ServiceGet {
        return GetCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName, serviceName: serviceName)
    }
    public static func List(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String) -> ServiceList {
        return ListCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName)
    }
    public static func Patch(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String, parameters: ServiceResourceUpdateProtocol) -> ServicePatch {
        return PatchCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName, serviceName: serviceName, parameters: parameters)
    }
    public static func Put(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String, parameters: ServiceResourceProtocol) -> ServicePut {
        return PutCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName, serviceName: serviceName, parameters: parameters)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol ServiceDelete  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var serviceName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (Error?) -> Void) -> Void;
}

extension Commands.Service {
// Delete deletes a service resource with the specified name. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
    internal class DeleteCommand : BaseCommand, ServiceDelete {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var serviceName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            self.serviceName = serviceName
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.pathParameters["{serviceName}"] = String(describing: self.serviceName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public func execute(client: RuntimeClient,
            completionHandler: @escaping (Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (error) in
                completionHandler(error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ServiceGet  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var serviceName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ServiceResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Service {
// Get returns a service resource with the specified name.
    internal class GetCommand : BaseCommand, ServiceGet {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var serviceName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            self.serviceName = serviceName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.pathParameters["{serviceName}"] = String(describing: self.serviceName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ServiceResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ServiceResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ServiceResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ServiceList  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ServiceResourceListProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Service {
// List returns all service resources in the specified application.
    internal class ListCommand : BaseCommand, ServiceList {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ServiceResourceListData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ServiceResourceListProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ServiceResourceListData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ServicePatch  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var serviceName : String { get set }
    var apiVersion : String { get set }
    var parameters :  ServiceResourceUpdateProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ServiceResourceUpdateProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Service {
// Patch updates a service resource with the specified name. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
    internal class PatchCommand : BaseCommand, ServicePatch {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var serviceName : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ServiceResourceUpdateProtocol?

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String, parameters: ServiceResourceUpdateProtocol) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            self.serviceName = serviceName
            self.parameters = parameters
            super.init()
            self.method = "Patch"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.pathParameters["{serviceName}"] = String(describing: self.serviceName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ServiceResourceUpdateData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ServiceResourceUpdateData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ServiceResourceUpdateProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ServiceResourceUpdateData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ServicePut  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var serviceName : String { get set }
    var apiVersion : String { get set }
    var parameters :  ServiceResourceProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ServiceResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Service {
// Put creates or updates a service resource with the specified name. This method may poll for completion. Polling can
// be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
    internal class PutCommand : BaseCommand, ServicePut {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var serviceName : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ServiceResourceProtocol?

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, serviceName: String, parameters: ServiceResourceProtocol) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            self.serviceName = serviceName
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.pathParameters["{serviceName}"] = String(describing: self.serviceName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ServiceResourceData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ServiceResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ServiceResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ServiceResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.

// Version is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Version {
    public static func Delete(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, version: String) -> VersionDelete {
        return DeleteCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName, version: version)
    }
    public static func Get(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, version: String) -> VersionGet {
        return GetCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName, version: version)
    }
    public static func List(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String) -> VersionList {
        return ListCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName)
    }
    public static func Put(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, version: String, parameters: VersionResourceProtocol) -> VersionPut {
        return PutCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationTypeName: applicationTypeName, version: version, parameters: parameters)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol VersionDelete  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var version : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (Error?) -> Void) -> Void;
}

extension Commands.Version {
// Delete unprovisions an application type version resource. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
    internal class DeleteCommand : BaseCommand, VersionDelete {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var version : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, version: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            self.version = version
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.pathParameters["{version}"] = String(describing: self.version)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public func execute(client: RuntimeClient,
            completionHandler: @escaping (Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (error) in
                completionHandler(error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol VersionGet  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var version : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (VersionResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Version {
// Get returns an application type version resource.
    internal class GetCommand : BaseCommand, VersionGet {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var version : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, version: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            self.version = version
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.pathParameters["{version}"] = String(describing: self.version)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(VersionResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (VersionResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: VersionResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol VersionList  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (VersionResourceListProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Version {
// List returns all versions for the specified application type.
    internal class ListCommand : BaseCommand, VersionList {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(VersionResourceListData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (VersionResourceListProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: VersionResourceListData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol VersionPut  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationTypeName : String { get set }
    var version : String { get set }
    var apiVersion : String { get set }
    var parameters :  VersionResourceProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (VersionResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Version {
// Put provisions an application type version resource. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
    internal class PutCommand : BaseCommand, VersionPut {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationTypeName : String
        public var version : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  VersionResourceProtocol?

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationTypeName: String, version: String, parameters: VersionResourceProtocol) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationTypeName = applicationTypeName
            self.version = version
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationTypeName}"] = String(describing: self.applicationTypeName)
            self.pathParameters["{version}"] = String(describing: self.version)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? VersionResourceData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(VersionResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (VersionResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: VersionResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ApplicationHealthPolicyData : ApplicationHealthPolicyProtocol {
    public var considerWarningAsError: Bool?
    public var maxPercentUnhealthyDeployedApplications: Int32?
    public var defaultServiceTypeHealthPolicy: ServiceTypeHealthPolicyProtocol?
    public var serviceTypeHealthPolicyMap: [ServiceTypeHealthPolicyMapItemProtocol?]?

        enum CodingKeys: String, CodingKey {case considerWarningAsError = "ConsiderWarningAsError"
        case maxPercentUnhealthyDeployedApplications = "MaxPercentUnhealthyDeployedApplications"
        case defaultServiceTypeHealthPolicy = "DefaultServiceTypeHealthPolicy"
        case serviceTypeHealthPolicyMap = "ServiceTypeHealthPolicyMap"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.considerWarningAsError) {
        self.considerWarningAsError = try container.decode(Bool?.self, forKey: .considerWarningAsError)
    }
    if container.contains(.maxPercentUnhealthyDeployedApplications) {
        self.maxPercentUnhealthyDeployedApplications = try container.decode(Int32?.self, forKey: .maxPercentUnhealthyDeployedApplications)
    }
    if container.contains(.defaultServiceTypeHealthPolicy) {
        self.defaultServiceTypeHealthPolicy = try container.decode(ServiceTypeHealthPolicyData?.self, forKey: .defaultServiceTypeHealthPolicy)
    }
    if container.contains(.serviceTypeHealthPolicyMap) {
        self.serviceTypeHealthPolicyMap = try container.decode([ServiceTypeHealthPolicyMapItemData?]?.self, forKey: .serviceTypeHealthPolicyMap)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.considerWarningAsError != nil {try container.encode(self.considerWarningAsError, forKey: .considerWarningAsError)}
    if self.maxPercentUnhealthyDeployedApplications != nil {try container.encode(self.maxPercentUnhealthyDeployedApplications, forKey: .maxPercentUnhealthyDeployedApplications)}
    if self.defaultServiceTypeHealthPolicy != nil {try container.encode(self.defaultServiceTypeHealthPolicy as! ServiceTypeHealthPolicyData?, forKey: .defaultServiceTypeHealthPolicy)}
    if self.serviceTypeHealthPolicyMap != nil {try container.encode(self.serviceTypeHealthPolicyMap as! [ServiceTypeHealthPolicyMapItemData?]?, forKey: .serviceTypeHealthPolicyMap)}
  }
}

extension DataFactory {
  public static func createApplicationHealthPolicyProtocol() -> ApplicationHealthPolicyProtocol {
    return ApplicationHealthPolicyData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ApplicationMetricDescriptionData : ApplicationMetricDescriptionProtocol {
    public var name: String?
    public var maximumCapacity: Int64?
    public var reservationCapacity: Int64?
    public var totalApplicationCapacity: Int64?

        enum CodingKeys: String, CodingKey {case name = "Name"
        case maximumCapacity = "MaximumCapacity"
        case reservationCapacity = "ReservationCapacity"
        case totalApplicationCapacity = "TotalApplicationCapacity"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.maximumCapacity) {
        self.maximumCapacity = try container.decode(Int64?.self, forKey: .maximumCapacity)
    }
    if container.contains(.reservationCapacity) {
        self.reservationCapacity = try container.decode(Int64?.self, forKey: .reservationCapacity)
    }
    if container.contains(.totalApplicationCapacity) {
        self.totalApplicationCapacity = try container.decode(Int64?.self, forKey: .totalApplicationCapacity)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.maximumCapacity != nil {try container.encode(self.maximumCapacity, forKey: .maximumCapacity)}
    if self.reservationCapacity != nil {try container.encode(self.reservationCapacity, forKey: .reservationCapacity)}
    if self.totalApplicationCapacity != nil {try container.encode(self.totalApplicationCapacity, forKey: .totalApplicationCapacity)}
  }
}

extension DataFactory {
  public static func createApplicationMetricDescriptionProtocol() -> ApplicationMetricDescriptionProtocol {
    return ApplicationMetricDescriptionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ApplicationParameterData : ApplicationParameterProtocol {
    public var key: String
    public var value: String

        enum CodingKeys: String, CodingKey {case key = "Key"
        case value = "Value"
        }

  public init(key: String, value: String)  {
    self.key = key
    self.value = value
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.key = try container.decode(String.self, forKey: .key)
    self.value = try container.decode(String.self, forKey: .value)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.key, forKey: .key)
    try container.encode(self.value, forKey: .value)
  }
}

extension DataFactory {
  public static func createApplicationParameterProtocol(key: String, value: String) -> ApplicationParameterProtocol {
    return ApplicationParameterData(key: key, value: value)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ApplicationPropertiesData : ApplicationPropertiesProtocol, ApplicationUpdatePropertiesProtocol {
    public var typeVersion: String?
    public var parameters: [ApplicationParameterProtocol?]?
    public var upgradePolicy: ApplicationUpgradePolicyProtocol?
    public var minimumNodes: Int64?
    public var maximumNodes: Int64?
    public var removeApplicationCapacity: Bool?
    public var metrics: [ApplicationMetricDescriptionProtocol?]?
    public var provisioningState: String?
    public var typeName: String?

        enum CodingKeys: String, CodingKey {case typeVersion = "typeVersion"
        case parameters = "parameters"
        case upgradePolicy = "upgradePolicy"
        case minimumNodes = "minimumNodes"
        case maximumNodes = "maximumNodes"
        case removeApplicationCapacity = "removeApplicationCapacity"
        case metrics = "metrics"
        case provisioningState = "provisioningState"
        case typeName = "typeName"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.typeVersion) {
        self.typeVersion = try container.decode(String?.self, forKey: .typeVersion)
    }
    if container.contains(.parameters) {
        self.parameters = try container.decode([ApplicationParameterData?]?.self, forKey: .parameters)
    }
    if container.contains(.upgradePolicy) {
        self.upgradePolicy = try container.decode(ApplicationUpgradePolicyData?.self, forKey: .upgradePolicy)
    }
    if container.contains(.minimumNodes) {
        self.minimumNodes = try container.decode(Int64?.self, forKey: .minimumNodes)
    }
    if container.contains(.maximumNodes) {
        self.maximumNodes = try container.decode(Int64?.self, forKey: .maximumNodes)
    }
    if container.contains(.removeApplicationCapacity) {
        self.removeApplicationCapacity = try container.decode(Bool?.self, forKey: .removeApplicationCapacity)
    }
    if container.contains(.metrics) {
        self.metrics = try container.decode([ApplicationMetricDescriptionData?]?.self, forKey: .metrics)
    }
    if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(String?.self, forKey: .provisioningState)
    }
    if container.contains(.typeName) {
        self.typeName = try container.decode(String?.self, forKey: .typeName)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.typeVersion != nil {try container.encode(self.typeVersion, forKey: .typeVersion)}
    if self.parameters != nil {try container.encode(self.parameters as! [ApplicationParameterData?]?, forKey: .parameters)}
    if self.upgradePolicy != nil {try container.encode(self.upgradePolicy as! ApplicationUpgradePolicyData?, forKey: .upgradePolicy)}
    if self.minimumNodes != nil {try container.encode(self.minimumNodes, forKey: .minimumNodes)}
    if self.maximumNodes != nil {try container.encode(self.maximumNodes, forKey: .maximumNodes)}
    if self.removeApplicationCapacity != nil {try container.encode(self.removeApplicationCapacity, forKey: .removeApplicationCapacity)}
    if self.metrics != nil {try container.encode(self.metrics as! [ApplicationMetricDescriptionData?]?, forKey: .metrics)}
    if self.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
    if self.typeName != nil {try container.encode(self.typeName, forKey: .typeName)}
  }
}

extension DataFactory {
  public static func createApplicationPropertiesProtocol() -> ApplicationPropertiesProtocol {
    return ApplicationPropertiesData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ApplicationResourceData : ApplicationResourceProtocol, ProxyResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String
    public var properties: ApplicationPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case location = "location"
        case properties = "properties"
        }

  public init(location: String)  {
    self.location = location
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.properties) {
        self.properties = try container.decode(ApplicationPropertiesData?.self, forKey: .properties)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.id != nil {try container.encode(self.id, forKey: .id)}
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    try container.encode(self.location, forKey: .location)
    if self.properties != nil {try container.encode(self.properties as! ApplicationPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createApplicationResourceProtocol(location: String) -> ApplicationResourceProtocol {
    return ApplicationResourceData(location: location)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ApplicationResourceListData : ApplicationResourceListProtocol {
    public var value: [ApplicationResourceProtocol?]?

        enum CodingKeys: String, CodingKey {case value = "value"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.value) {
        self.value = try container.decode([ApplicationResourceData?]?.self, forKey: .value)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.value != nil {try container.encode(self.value as! [ApplicationResourceData?]?, forKey: .value)}
  }
}

extension DataFactory {
  public static func createApplicationResourceListProtocol() -> ApplicationResourceListProtocol {
    return ApplicationResourceListData()
  }
}