// 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 OperationData : OperationProtocol {
    public var name: String?
    public var display: OperationDisplayProtocol?

        enum CodingKeys: String, CodingKey {case name = "name"
        case display = "display"
        }

  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(.display) {
        self.display = try container.decode(OperationDisplayData?.self, forKey: .display)
    }
    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.display != nil {try container.encode(self.display as! OperationDisplayData?, forKey: .display)}
  }
}

extension DataFactory {
  public static func createOperationProtocol() -> OperationProtocol {
    return OperationData()
  }
}


// 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 OperationDisplayData : OperationDisplayProtocol {
    public var provider: String?
    public var resource: String?
    public var operation: String?
    public var description: String?

        enum CodingKeys: String, CodingKey {case provider = "Provider"
        case resource = "Resource"
        case operation = "Operation"
        case description = "Description"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.provider) {
        self.provider = try container.decode(String?.self, forKey: .provider)
    }
    if container.contains(.resource) {
        self.resource = try container.decode(String?.self, forKey: .resource)
    }
    if container.contains(.operation) {
        self.operation = try container.decode(String?.self, forKey: .operation)
    }
    if container.contains(.description) {
        self.description = try container.decode(String?.self, forKey: .description)
    }
    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.provider != nil {try container.encode(self.provider, forKey: .provider)}
    if self.resource != nil {try container.encode(self.resource, forKey: .resource)}
    if self.operation != nil {try container.encode(self.operation, forKey: .operation)}
    if self.description != nil {try container.encode(self.description, forKey: .description)}
  }
}

extension DataFactory {
  public static func createOperationDisplayProtocol() -> OperationDisplayProtocol {
    return OperationDisplayData()
  }
}


// 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 OperationListResultData : OperationListResultProtocol {
    public var value: [OperationProtocol?]?
    public var _nextLink: String?

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

  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([OperationData?]?.self, forKey: .value)
    }
    if container.contains(._nextLink) {
        self._nextLink = try container.decode(String?.self, forKey: ._nextLink)
    }
    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! [OperationData?]?, forKey: .value)}
    if self._nextLink != nil {try container.encode(self._nextLink, forKey: ._nextLink)}
  }
}

extension DataFactory {
  public static func createOperationListResultProtocol() -> OperationListResultProtocol {
    return OperationListResultData()
  }
}


// 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 PartitionMetricData : PartitionMetricProtocol, MetricProtocol {
    public var startTime: Date?
    public var endTime: Date?
    public var timeGrain: String?
    public var unit: UnitTypeEnum?
    public var name: MetricNameProtocol?
    public var metricValues: [MetricValueProtocol?]?
    public var partitionId: String?
    public var partitionKeyRangeId: String?

        enum CodingKeys: String, CodingKey {case startTime = "startTime"
        case endTime = "endTime"
        case timeGrain = "timeGrain"
        case unit = "unit"
        case name = "name"
        case metricValues = "metricValues"
        case partitionId = "partitionId"
        case partitionKeyRangeId = "partitionKeyRangeId"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.startTime) {
        self.startTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startTime)), format: .dateTime)
    }
    if container.contains(.endTime) {
        self.endTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .endTime)), format: .dateTime)
    }
    if container.contains(.timeGrain) {
        self.timeGrain = try container.decode(String?.self, forKey: .timeGrain)
    }
    if container.contains(.unit) {
        self.unit = try container.decode(UnitTypeEnum?.self, forKey: .unit)
    }
    if container.contains(.name) {
        self.name = try container.decode(MetricNameData?.self, forKey: .name)
    }
    if container.contains(.metricValues) {
        self.metricValues = try container.decode([MetricValueData?]?.self, forKey: .metricValues)
    }
    if container.contains(.partitionId) {
        self.partitionId = try container.decode(String?.self, forKey: .partitionId)
    }
    if container.contains(.partitionKeyRangeId) {
        self.partitionKeyRangeId = try container.decode(String?.self, forKey: .partitionKeyRangeId)
    }
    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.startTime != nil {
        try container.encode(DateConverter.toString(date: self.startTime!, format: .dateTime), forKey: .startTime)
    }
    if self.endTime != nil {
        try container.encode(DateConverter.toString(date: self.endTime!, format: .dateTime), forKey: .endTime)
    }
    if self.timeGrain != nil {try container.encode(self.timeGrain, forKey: .timeGrain)}
    if self.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.name != nil {try container.encode(self.name as! MetricNameData?, forKey: .name)}
    if self.metricValues != nil {try container.encode(self.metricValues as! [MetricValueData?]?, forKey: .metricValues)}
    if self.partitionId != nil {try container.encode(self.partitionId, forKey: .partitionId)}
    if self.partitionKeyRangeId != nil {try container.encode(self.partitionKeyRangeId, forKey: .partitionKeyRangeId)}
  }
}

extension DataFactory {
  public static func createPartitionMetricProtocol() -> PartitionMetricProtocol {
    return PartitionMetricData()
  }
}


// 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 PartitionMetricListResultData : PartitionMetricListResultProtocol {
    public var value: [PartitionMetricProtocol?]?

        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([PartitionMetricData?]?.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! [PartitionMetricData?]?, forKey: .value)}
  }
}

extension DataFactory {
  public static func createPartitionMetricListResultProtocol() -> PartitionMetricListResultProtocol {
    return PartitionMetricListResultData()
  }
}


// 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 PartitionUsageData : PartitionUsageProtocol, UsageProtocol {
    public var unit: UnitTypeEnum?
    public var name: MetricNameProtocol?
    public var quotaPeriod: String?
    public var limit: Int32?
    public var currentValue: Int32?
    public var partitionId: String?
    public var partitionKeyRangeId: String?

        enum CodingKeys: String, CodingKey {case unit = "unit"
        case name = "name"
        case quotaPeriod = "quotaPeriod"
        case limit = "limit"
        case currentValue = "currentValue"
        case partitionId = "partitionId"
        case partitionKeyRangeId = "partitionKeyRangeId"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.unit) {
        self.unit = try container.decode(UnitTypeEnum?.self, forKey: .unit)
    }
    if container.contains(.name) {
        self.name = try container.decode(MetricNameData?.self, forKey: .name)
    }
    if container.contains(.quotaPeriod) {
        self.quotaPeriod = try container.decode(String?.self, forKey: .quotaPeriod)
    }
    if container.contains(.limit) {
        self.limit = try container.decode(Int32?.self, forKey: .limit)
    }
    if container.contains(.currentValue) {
        self.currentValue = try container.decode(Int32?.self, forKey: .currentValue)
    }
    if container.contains(.partitionId) {
        self.partitionId = try container.decode(String?.self, forKey: .partitionId)
    }
    if container.contains(.partitionKeyRangeId) {
        self.partitionKeyRangeId = try container.decode(String?.self, forKey: .partitionKeyRangeId)
    }
    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.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.name != nil {try container.encode(self.name as! MetricNameData?, forKey: .name)}
    if self.quotaPeriod != nil {try container.encode(self.quotaPeriod, forKey: .quotaPeriod)}
    if self.limit != nil {try container.encode(self.limit, forKey: .limit)}
    if self.currentValue != nil {try container.encode(self.currentValue, forKey: .currentValue)}
    if self.partitionId != nil {try container.encode(self.partitionId, forKey: .partitionId)}
    if self.partitionKeyRangeId != nil {try container.encode(self.partitionKeyRangeId, forKey: .partitionKeyRangeId)}
  }
}

extension DataFactory {
  public static func createPartitionUsageProtocol() -> PartitionUsageProtocol {
    return PartitionUsageData()
  }
}


// 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 PartitionUsagesResultData : PartitionUsagesResultProtocol {
    public var value: [PartitionUsageProtocol?]?

        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([PartitionUsageData?]?.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! [PartitionUsageData?]?, forKey: .value)}
  }
}

extension DataFactory {
  public static func createPartitionUsagesResultProtocol() -> PartitionUsagesResultProtocol {
    return PartitionUsagesResultData()
  }
}


// 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 PercentileMetricData : PercentileMetricProtocol {
    public var startTime: Date?
    public var endTime: Date?
    public var timeGrain: String?
    public var unit: UnitTypeEnum?
    public var name: MetricNameProtocol?
    public var metricValues: [PercentileMetricValueProtocol?]?

        enum CodingKeys: String, CodingKey {case startTime = "startTime"
        case endTime = "endTime"
        case timeGrain = "timeGrain"
        case unit = "unit"
        case name = "name"
        case metricValues = "metricValues"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.startTime) {
        self.startTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startTime)), format: .dateTime)
    }
    if container.contains(.endTime) {
        self.endTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .endTime)), format: .dateTime)
    }
    if container.contains(.timeGrain) {
        self.timeGrain = try container.decode(String?.self, forKey: .timeGrain)
    }
    if container.contains(.unit) {
        self.unit = try container.decode(UnitTypeEnum?.self, forKey: .unit)
    }
    if container.contains(.name) {
        self.name = try container.decode(MetricNameData?.self, forKey: .name)
    }
    if container.contains(.metricValues) {
        self.metricValues = try container.decode([PercentileMetricValueData?]?.self, forKey: .metricValues)
    }
    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.startTime != nil {
        try container.encode(DateConverter.toString(date: self.startTime!, format: .dateTime), forKey: .startTime)
    }
    if self.endTime != nil {
        try container.encode(DateConverter.toString(date: self.endTime!, format: .dateTime), forKey: .endTime)
    }
    if self.timeGrain != nil {try container.encode(self.timeGrain, forKey: .timeGrain)}
    if self.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.name != nil {try container.encode(self.name as! MetricNameData?, forKey: .name)}
    if self.metricValues != nil {try container.encode(self.metricValues as! [PercentileMetricValueData?]?, forKey: .metricValues)}
  }
}

extension DataFactory {
  public static func createPercentileMetricProtocol() -> PercentileMetricProtocol {
    return PercentileMetricData()
  }
}


// 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 PercentileMetricListResultData : PercentileMetricListResultProtocol {
    public var value: [PercentileMetricProtocol?]?

        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([PercentileMetricData?]?.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! [PercentileMetricData?]?, forKey: .value)}
  }
}

extension DataFactory {
  public static func createPercentileMetricListResultProtocol() -> PercentileMetricListResultProtocol {
    return PercentileMetricListResultData()
  }
}


// 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 PercentileMetricValueData : PercentileMetricValueProtocol, MetricValueProtocol {
    public var _count: Double?
    public var average: Double?
    public var maximum: Double?
    public var minimum: Double?
    public var timestamp: Date?
    public var total: Double?
    public var p10: Double?
    public var p25: Double?
    public var p50: Double?
    public var p75: Double?
    public var p90: Double?
    public var p95: Double?
    public var p99: Double?

        enum CodingKeys: String, CodingKey {case _count = "_count"
        case average = "average"
        case maximum = "maximum"
        case minimum = "minimum"
        case timestamp = "timestamp"
        case total = "total"
        case p10 = "P10"
        case p25 = "P25"
        case p50 = "P50"
        case p75 = "P75"
        case p90 = "P90"
        case p95 = "P95"
        case p99 = "P99"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(._count) {
        self._count = try container.decode(Double?.self, forKey: ._count)
    }
    if container.contains(.average) {
        self.average = try container.decode(Double?.self, forKey: .average)
    }
    if container.contains(.maximum) {
        self.maximum = try container.decode(Double?.self, forKey: .maximum)
    }
    if container.contains(.minimum) {
        self.minimum = try container.decode(Double?.self, forKey: .minimum)
    }
    if container.contains(.timestamp) {
        self.timestamp = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .timestamp)), format: .dateTime)
    }
    if container.contains(.total) {
        self.total = try container.decode(Double?.self, forKey: .total)
    }
    if container.contains(.p10) {
        self.p10 = try container.decode(Double?.self, forKey: .p10)
    }
    if container.contains(.p25) {
        self.p25 = try container.decode(Double?.self, forKey: .p25)
    }
    if container.contains(.p50) {
        self.p50 = try container.decode(Double?.self, forKey: .p50)
    }
    if container.contains(.p75) {
        self.p75 = try container.decode(Double?.self, forKey: .p75)
    }
    if container.contains(.p90) {
        self.p90 = try container.decode(Double?.self, forKey: .p90)
    }
    if container.contains(.p95) {
        self.p95 = try container.decode(Double?.self, forKey: .p95)
    }
    if container.contains(.p99) {
        self.p99 = try container.decode(Double?.self, forKey: .p99)
    }
    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._count != nil {try container.encode(self._count, forKey: ._count)}
    if self.average != nil {try container.encode(self.average, forKey: .average)}
    if self.maximum != nil {try container.encode(self.maximum, forKey: .maximum)}
    if self.minimum != nil {try container.encode(self.minimum, forKey: .minimum)}
    if self.timestamp != nil {
        try container.encode(DateConverter.toString(date: self.timestamp!, format: .dateTime), forKey: .timestamp)
    }
    if self.total != nil {try container.encode(self.total, forKey: .total)}
    if self.p10 != nil {try container.encode(self.p10, forKey: .p10)}
    if self.p25 != nil {try container.encode(self.p25, forKey: .p25)}
    if self.p50 != nil {try container.encode(self.p50, forKey: .p50)}
    if self.p75 != nil {try container.encode(self.p75, forKey: .p75)}
    if self.p90 != nil {try container.encode(self.p90, forKey: .p90)}
    if self.p95 != nil {try container.encode(self.p95, forKey: .p95)}
    if self.p99 != nil {try container.encode(self.p99, forKey: .p99)}
  }
}

extension DataFactory {
  public static func createPercentileMetricValueProtocol() -> PercentileMetricValueProtocol {
    return PercentileMetricValueData()
  }
}


// PrimaryAggregationType enumerates the values for primary aggregation type.

// 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 enum PrimaryAggregationTypeEnum: String, Codable
{
// Average specifies the average state for primary aggregation type.
    case Average = "Average"
// Last specifies the last state for primary aggregation type.
    case Last = "Last"
// Maximum specifies the maximum state for primary aggregation type.
    case Maximum = "Maximum"
// Minimimum specifies the minimimum state for primary aggregation type.
    case Minimimum = "Minimimum"
// None specifies the none state for primary aggregation type.
    case None = "None"
// Total specifies the total state for primary aggregation type.
    case Total = "Total"
}


// 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 ResourceData : ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String
    public var tags: [String:String]?

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

  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(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    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.tags != nil {try container.encode(self.tags, forKey: .tags)}
  }
}

extension DataFactory {
  public static func createResourceProtocol(location: String) -> ResourceProtocol {
    return ResourceData(location: location)
  }
}


// UnitType enumerates the values for unit type.

// 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 enum UnitTypeEnum: String, Codable
{
// Bytes specifies the bytes state for unit type.
    case Bytes = "Bytes"
// BytesPerSecond specifies the bytes per second state for unit type.
    case BytesPerSecond = "BytesPerSecond"
// Count specifies the count state for unit type.
    case Count = "Count"
// CountPerSecond specifies the count per second state for unit type.
    case CountPerSecond = "CountPerSecond"
// Milliseconds specifies the milliseconds state for unit type.
    case Milliseconds = "Milliseconds"
// Percent specifies the percent state for unit type.
    case Percent = "Percent"
// Seconds specifies the seconds state for unit type.
    case Seconds = "Seconds"
}


// 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 UsageData : UsageProtocol {
    public var unit: UnitTypeEnum?
    public var name: MetricNameProtocol?
    public var quotaPeriod: String?
    public var limit: Int32?
    public var currentValue: Int32?

        enum CodingKeys: String, CodingKey {case unit = "unit"
        case name = "name"
        case quotaPeriod = "quotaPeriod"
        case limit = "limit"
        case currentValue = "currentValue"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.unit) {
        self.unit = try container.decode(UnitTypeEnum?.self, forKey: .unit)
    }
    if container.contains(.name) {
        self.name = try container.decode(MetricNameData?.self, forKey: .name)
    }
    if container.contains(.quotaPeriod) {
        self.quotaPeriod = try container.decode(String?.self, forKey: .quotaPeriod)
    }
    if container.contains(.limit) {
        self.limit = try container.decode(Int32?.self, forKey: .limit)
    }
    if container.contains(.currentValue) {
        self.currentValue = try container.decode(Int32?.self, forKey: .currentValue)
    }
    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.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.name != nil {try container.encode(self.name as! MetricNameData?, forKey: .name)}
    if self.quotaPeriod != nil {try container.encode(self.quotaPeriod, forKey: .quotaPeriod)}
    if self.limit != nil {try container.encode(self.limit, forKey: .limit)}
    if self.currentValue != nil {try container.encode(self.currentValue, forKey: .currentValue)}
  }
}

extension DataFactory {
  public static func createUsageProtocol() -> UsageProtocol {
    return UsageData()
  }
}


// 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 UsagesResultData : UsagesResultProtocol {
    public var value: [UsageProtocol?]?

        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([UsageData?]?.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! [UsageData?]?, forKey: .value)}
  }
}

extension DataFactory {
  public static func createUsagesResultProtocol() -> UsagesResultProtocol {
    return UsagesResultData()
  }
}


// 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
// CapabilityProtocol is cosmos DB capability object
public protocol CapabilityProtocol : Codable {
     var name: String? { get set }
}


// 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
// ConsistencyPolicyProtocol is the consistency policy for the Cosmos DB database account.
public protocol ConsistencyPolicyProtocol : Codable {
     var defaultConsistencyLevel: DefaultConsistencyLevelEnum { get set }
     var maxStalenessPrefix: Int64? { get set }
     var maxIntervalInSeconds: Int32? { get set }
}


// 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
// DatabaseAccountConnectionStringProtocol is connection string for the Cosmos DB account
public protocol DatabaseAccountConnectionStringProtocol : Codable {
     var connectionString: String? { get set }
     var description: String? { get set }
}


// 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
// DatabaseAccountCreateUpdateParametersProtocol is parameters to create and update Cosmos DB database accounts.
public protocol DatabaseAccountCreateUpdateParametersProtocol : ResourceProtocol {
     var kind: DatabaseAccountKindEnum? { get set }
     var properties: DatabaseAccountCreateUpdatePropertiesProtocol { get set }
}


// 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
// DatabaseAccountCreateUpdatePropertiesProtocol is properties to create and update Azure Cosmos DB database accounts.
public protocol DatabaseAccountCreateUpdatePropertiesProtocol : Codable {
     var consistencyPolicy: ConsistencyPolicyProtocol? { get set }
     var locations: [LocationProtocol] { get set }
     var databaseAccountOfferType: String { get set }
     var ipRangeFilter: String? { get set }
     var enableAutomaticFailover: Bool? { get set }
     var capabilities: [CapabilityProtocol?]? { get set }
}


// 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
// DatabaseAccountListConnectionStringsResultProtocol is the connection strings for the given database account.
public protocol DatabaseAccountListConnectionStringsResultProtocol : Codable {
     var connectionStrings: [DatabaseAccountConnectionStringProtocol?]? { get set }
}


// 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
// DatabaseAccountListKeysResultProtocol is the access keys for the given database account.
public protocol DatabaseAccountListKeysResultProtocol : Codable {
     var primaryMasterKey: String? { get set }
     var secondaryMasterKey: String? { get set }
     var properties: DatabaseAccountListReadOnlyKeysResultProtocol? { get set }
}


// 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
// DatabaseAccountListReadOnlyKeysResultProtocol is the read-only access keys for the given database account.
public protocol DatabaseAccountListReadOnlyKeysResultProtocol : Codable {
     var primaryReadonlyMasterKey: String? { get set }
     var secondaryReadonlyMasterKey: String? { get set }
}


// 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
// DatabaseAccountPatchParametersProtocol is parameters for patching Azure Cosmos DB database account properties.
public protocol DatabaseAccountPatchParametersProtocol : Codable {
     var tags: [String:String]? { get set }
     var properties: DatabaseAccountPatchPropertiesProtocol? { get set }
}


// 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
// DatabaseAccountPatchPropertiesProtocol is properties to update Azure Cosmos DB database accounts.
public protocol DatabaseAccountPatchPropertiesProtocol : Codable {
     var capabilities: [CapabilityProtocol?]? { get set }
}


// 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
// DatabaseAccountPropertiesProtocol is properties for the database account.
public protocol DatabaseAccountPropertiesProtocol : Codable {
     var provisioningState: String? { get set }
     var documentEndpoint: String? { get set }
     var databaseAccountOfferType: DatabaseAccountOfferTypeEnum? { get set }
     var ipRangeFilter: String? { get set }
     var enableAutomaticFailover: Bool? { get set }
     var consistencyPolicy: ConsistencyPolicyProtocol? { get set }
     var capabilities: [CapabilityProtocol?]? { get set }
     var writeLocations: [LocationProtocol?]? { get set }
     var readLocations: [LocationProtocol?]? { get set }
     var failoverPolicies: [FailoverPolicyProtocol?]? { get set }
}


// 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
// DatabaseAccountProtocol is an Azure Cosmos DB database account.
public protocol DatabaseAccountProtocol : ResourceProtocol {
     var kind: DatabaseAccountKindEnum? { get set }
     var properties: DatabaseAccountPropertiesProtocol? { get set }
}


// 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
// DatabaseAccountRegenerateKeyParametersProtocol is parameters to regenerate the keys within the database account.
public protocol DatabaseAccountRegenerateKeyParametersProtocol : Codable {
     var keyKind: KeyKindEnum { get set }
}


// 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
// DatabaseAccountsListResultProtocol is the List operation response, that contains the database accounts and their
// properties.
public protocol DatabaseAccountsListResultProtocol : Codable {
     var value: [DatabaseAccountProtocol?]? { get set }
}


// 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
// FailoverPoliciesProtocol is the list of new failover policies for the failover priority change.
public protocol FailoverPoliciesProtocol : Codable {
     var failoverPolicies: [FailoverPolicyProtocol] { get set }
}


// 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
// FailoverPolicyProtocol is the failover policy for a given region of a database account.
public protocol FailoverPolicyProtocol : Codable {
     var id: String? { get set }
     var locationName: String? { get set }
     var failoverPriority: Int32? { get set }
}


// 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
// LocationProtocol is a region in which the Azure Cosmos DB database account is deployed.
public protocol LocationProtocol : Codable {
     var id: String? { get set }
     var locationName: String? { get set }
     var documentEndpoint: String? { get set }
     var provisioningState: String? { get set }
     var failoverPriority: Int32? { get set }
}


// 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
// MetricAvailabilityProtocol is the availability of the metric.
public protocol MetricAvailabilityProtocol : Codable {
     var timeGrain: String? { get set }
     var retention: String? { get set }
}


// 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
// MetricDefinitionProtocol is the definition of a metric.
public protocol MetricDefinitionProtocol : Codable {
     var metricAvailabilities: [MetricAvailabilityProtocol?]? { get set }
     var primaryAggregationType: PrimaryAggregationTypeEnum? { get set }
     var unit: UnitTypeEnum? { get set }
     var resourceUri: String? { get set }
     var name: MetricNameProtocol? { get set }
}


// 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
// MetricDefinitionsListResultProtocol is the response to a list metric definitions request.
public protocol MetricDefinitionsListResultProtocol : Codable {
     var value: [MetricDefinitionProtocol?]? { get set }
}


// 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
// MetricListResultProtocol is the response to a list metrics request.
public protocol MetricListResultProtocol : Codable {
     var value: [MetricProtocol?]? { get set }
}


// 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
// MetricNameProtocol is a metric name.
public protocol MetricNameProtocol : Codable {
     var value: String? { get set }
     var localizedValue: String? { get set }
}


// 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
// MetricProtocol is metric data
public protocol MetricProtocol : Codable {
     var startTime: Date? { get set }
     var endTime: Date? { get set }
     var timeGrain: String? { get set }
     var unit: UnitTypeEnum? { get set }
     var name: MetricNameProtocol? { get set }
     var metricValues: [MetricValueProtocol?]? { get set }
}


// 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
// MetricValueProtocol is represents metrics values.
public protocol MetricValueProtocol : Codable {
     var _count: Double? { get set }
     var average: Double? { get set }
     var maximum: Double? { get set }
     var minimum: Double? { get set }
     var timestamp: Date? { get set }
     var total: Double? { get set }
}


// 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
// OperationDisplayProtocol is the object that represents the operation.
public protocol OperationDisplayProtocol : Codable {
     var provider: String? { get set }
     var resource: String? { get set }
     var operation: String? { get set }
     var description: String? { get set }
}


// 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
// OperationListResultProtocol is result of the request to list Resource Provider operations. It contains a list of
// operations and a URL link to get the next set of results.
public protocol OperationListResultProtocol : Codable {
     var value: [OperationProtocol?]? { get set }
     var _nextLink: String? { get set }
}


// 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
// OperationProtocol is REST API operation
public protocol OperationProtocol : Codable {
     var name: String? { get set }
     var display: OperationDisplayProtocol? { get set }
}


// 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
// PartitionMetricListResultProtocol is the response to a list partition metrics request.
public protocol PartitionMetricListResultProtocol : Codable {
     var value: [PartitionMetricProtocol?]? { get set }
}


// 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
// PartitionMetricProtocol is the metric values for a single partition.
public protocol PartitionMetricProtocol : MetricProtocol {
     var partitionId: String? { get set }
     var partitionKeyRangeId: String? { get set }
}


// 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
// PartitionUsageProtocol is the partition level usage data for a usage request.
public protocol PartitionUsageProtocol : UsageProtocol {
     var partitionId: String? { get set }
     var partitionKeyRangeId: String? { get set }
}


// 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
// PartitionUsagesResultProtocol is the response to a list partition level usage request.
public protocol PartitionUsagesResultProtocol : Codable {
     var value: [PartitionUsageProtocol?]? { get set }
}


// 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
// PercentileMetricListResultProtocol is the response to a list percentile metrics request.
public protocol PercentileMetricListResultProtocol : Codable {
     var value: [PercentileMetricProtocol?]? { get set }
}


// 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
// PercentileMetricProtocol is percentile Metric data
public protocol PercentileMetricProtocol : Codable {
     var startTime: Date? { get set }
     var endTime: Date? { get set }
     var timeGrain: String? { get set }
     var unit: UnitTypeEnum? { get set }
     var name: MetricNameProtocol? { get set }
     var metricValues: [PercentileMetricValueProtocol?]? { get set }
}


// 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
// PercentileMetricValueProtocol is represents percentile metrics values.
public protocol PercentileMetricValueProtocol : MetricValueProtocol {
     var p10: Double? { get set }
     var p25: Double? { get set }
     var p50: Double? { get set }
     var p75: Double? { get set }
     var p90: Double? { get set }
     var p95: Double? { get set }
     var p99: Double? { get set }
}


// 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
// ResourceProtocol is a database account resource.
public protocol ResourceProtocol : Codable {
     var id: String? { get set }
     var name: String? { get set }
     var type: String? { get set }
     var location: String { get set }
     var tags: [String:String]? { get set }
}


// 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
// UsageProtocol is the usage data for a usage request.
public protocol UsageProtocol : Codable {
     var unit: UnitTypeEnum? { get set }
     var name: MetricNameProtocol? { get set }
     var quotaPeriod: String? { get set }
     var limit: Int32? { get set }
     var currentValue: Int32? { get set }
}


// 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
// UsagesResultProtocol is the response to a list usage request.
public protocol UsagesResultProtocol : Codable {
     var value: [UsageProtocol?]? { get set }
}


// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
    name: "customerinsights",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "customerinsights",
            targets: ["customerinsights"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.0.10"),
        .package(url: "https://github.com/ReactiveX/RxSwift.git", from: "3.4.2"),
        .package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "3.1.4"),
        .package(url: "git@github.com:alvadb/autorest-clientruntime-for-swift.git", .branch("master"))
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "customerinsights",
            dependencies: ["Alamofire", "RxSwift", "SwiftyJSON", "azureSwiftRuntime"])
    ]
)


// 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.

// AuthorizationPolicies is the the Azure Customer Insights management API provides a RESTful set of web services that
// interact with Azure Customer Insights service to manage your resources. The API has entities that capture the
// relationship between an end user and the Azure Customer Insights service.
import Foundation
import azureSwiftRuntime
extension Commands {
public struct AuthorizationPolicies {
    public static func CreateOrUpdate(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String, parameters: AuthorizationPolicyResourceFormatProtocol) -> AuthorizationPoliciesCreateOrUpdate {
        return CreateOrUpdateCommand(resourceGroupName: resourceGroupName, hubName: hubName, authorizationPolicyName: authorizationPolicyName, subscriptionId: subscriptionId, parameters: parameters)
    }
    public static func Get(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String) -> AuthorizationPoliciesGet {
        return GetCommand(resourceGroupName: resourceGroupName, hubName: hubName, authorizationPolicyName: authorizationPolicyName, subscriptionId: subscriptionId)
    }
    public static func ListByHub(resourceGroupName: String, hubName: String, subscriptionId: String) -> AuthorizationPoliciesListByHub {
        return ListByHubCommand(resourceGroupName: resourceGroupName, hubName: hubName, subscriptionId: subscriptionId)
    }
    public static func RegeneratePrimaryKey(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String) -> AuthorizationPoliciesRegeneratePrimaryKey {
        return RegeneratePrimaryKeyCommand(resourceGroupName: resourceGroupName, hubName: hubName, authorizationPolicyName: authorizationPolicyName, subscriptionId: subscriptionId)
    }
    public static func RegenerateSecondaryKey(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String) -> AuthorizationPoliciesRegenerateSecondaryKey {
        return RegenerateSecondaryKeyCommand(resourceGroupName: resourceGroupName, hubName: hubName, authorizationPolicyName: authorizationPolicyName, subscriptionId: subscriptionId)
    }
}
}


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

extension Commands.AuthorizationPolicies {
// CreateOrUpdate creates an authorization policy or updates an existing authorization policy.
    internal class CreateOrUpdateCommand : BaseCommand, AuthorizationPoliciesCreateOrUpdate {
        public var resourceGroupName : String
        public var hubName : String
        public var authorizationPolicyName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"
    public var parameters :  AuthorizationPolicyResourceFormatProtocol?

        public init(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String, parameters: AuthorizationPolicyResourceFormatProtocol) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.authorizationPolicyName = authorizationPolicyName
            self.subscriptionId = subscriptionId
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{authorizationPolicyName}"] = String(describing: self.authorizationPolicyName)
            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? AuthorizationPolicyResourceFormatData)
                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(AuthorizationPolicyResourceFormatData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (AuthorizationPolicyResourceFormatProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: AuthorizationPolicyResourceFormatData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.AuthorizationPolicies {
// Get gets an authorization policy in the hub.
    internal class GetCommand : BaseCommand, AuthorizationPoliciesGet {
        public var resourceGroupName : String
        public var hubName : String
        public var authorizationPolicyName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

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

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{authorizationPolicyName}"] = String(describing: self.authorizationPolicyName)
            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(AuthorizationPolicyResourceFormatData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (AuthorizationPolicyResourceFormatProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: AuthorizationPolicyResourceFormatData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.AuthorizationPolicies {
// ListByHub gets all the authorization policies in a specified hub.
    internal class ListByHubCommand : BaseCommand, AuthorizationPoliciesListByHub {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var resourceGroupName : String
        public var hubName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

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

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            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)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(AuthorizationPolicyListResultData?.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 (AuthorizationPolicyListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: AuthorizationPolicyListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.AuthorizationPolicies {
// RegeneratePrimaryKey regenerates the primary policy key of the specified authorization policy.
    internal class RegeneratePrimaryKeyCommand : BaseCommand, AuthorizationPoliciesRegeneratePrimaryKey {
        public var resourceGroupName : String
        public var hubName : String
        public var authorizationPolicyName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

        public init(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.authorizationPolicyName = authorizationPolicyName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Post"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regeneratePrimaryKey"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{authorizationPolicyName}"] = String(describing: self.authorizationPolicyName)
            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(AuthorizationPolicyData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (AuthorizationPolicyProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: AuthorizationPolicyData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.AuthorizationPolicies {
// RegenerateSecondaryKey regenerates the secondary policy key of the specified authorization policy.
    internal class RegenerateSecondaryKeyCommand : BaseCommand, AuthorizationPoliciesRegenerateSecondaryKey {
        public var resourceGroupName : String
        public var hubName : String
        public var authorizationPolicyName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

        public init(resourceGroupName: String, hubName: String, authorizationPolicyName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.authorizationPolicyName = authorizationPolicyName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Post"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/authorizationPolicies/{authorizationPolicyName}/regenerateSecondaryKey"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{authorizationPolicyName}"] = String(describing: self.authorizationPolicyName)
            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(AuthorizationPolicyData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (AuthorizationPolicyProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: AuthorizationPolicyData?, 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.

// ConnectorMappings is the the Azure Customer Insights management API provides a RESTful set of web services that
// interact with Azure Customer Insights service to manage your resources. The API has entities that capture the
// relationship between an end user and the Azure Customer Insights service.
import Foundation
import azureSwiftRuntime
extension Commands {
public struct ConnectorMappings {
    public static func CreateOrUpdate(resourceGroupName: String, hubName: String, connectorName: String, mappingName: String, subscriptionId: String, parameters: ConnectorMappingResourceFormatProtocol) -> ConnectorMappingsCreateOrUpdate {
        return CreateOrUpdateCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, mappingName: mappingName, subscriptionId: subscriptionId, parameters: parameters)
    }
    public static func Delete(resourceGroupName: String, hubName: String, connectorName: String, mappingName: String, subscriptionId: String) -> ConnectorMappingsDelete {
        return DeleteCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, mappingName: mappingName, subscriptionId: subscriptionId)
    }
    public static func Get(resourceGroupName: String, hubName: String, connectorName: String, mappingName: String, subscriptionId: String) -> ConnectorMappingsGet {
        return GetCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, mappingName: mappingName, subscriptionId: subscriptionId)
    }
    public static func ListByConnector(resourceGroupName: String, hubName: String, connectorName: String, subscriptionId: String) -> ConnectorMappingsListByConnector {
        return ListByConnectorCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, subscriptionId: subscriptionId)
    }
}
}


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

extension Commands.ConnectorMappings {
// CreateOrUpdate creates a connector mapping or updates an existing connector mapping in the connector.
    internal class CreateOrUpdateCommand : BaseCommand, ConnectorMappingsCreateOrUpdate {
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var mappingName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"
    public var parameters :  ConnectorMappingResourceFormatProtocol?

        public init(resourceGroupName: String, hubName: String, connectorName: String, mappingName: String, subscriptionId: String, parameters: ConnectorMappingResourceFormatProtocol) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.connectorName = connectorName
            self.mappingName = mappingName
            self.subscriptionId = subscriptionId
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            self.pathParameters["{mappingName}"] = String(describing: self.mappingName)
            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? ConnectorMappingResourceFormatData)
                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(ConnectorMappingResourceFormatData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ConnectorMappingResourceFormatProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ConnectorMappingResourceFormatData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.ConnectorMappings {
// Delete deletes a connector mapping in the connector.
    internal class DeleteCommand : BaseCommand, ConnectorMappingsDelete {
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var mappingName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

        public init(resourceGroupName: String, hubName: String, connectorName: String, mappingName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.connectorName = connectorName
            self.mappingName = mappingName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            self.pathParameters["{mappingName}"] = String(describing: self.mappingName)
            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 ConnectorMappingsGet  {
    var headerParameters: [String: String] { get set }
    var resourceGroupName : String { get set }
    var hubName : String { get set }
    var connectorName : String { get set }
    var mappingName : String { get set }
    var subscriptionId : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ConnectorMappingResourceFormatProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ConnectorMappings {
// Get gets a connector mapping in the connector.
    internal class GetCommand : BaseCommand, ConnectorMappingsGet {
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var mappingName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

        public init(resourceGroupName: String, hubName: String, connectorName: String, mappingName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.connectorName = connectorName
            self.mappingName = mappingName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}/mappings/{mappingName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            self.pathParameters["{mappingName}"] = String(describing: self.mappingName)
            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(ConnectorMappingResourceFormatData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ConnectorMappingResourceFormatProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ConnectorMappingResourceFormatData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.ConnectorMappings {
// ListByConnector gets all the connector mappings in the specified connector.
    internal class ListByConnectorCommand : BaseCommand, ConnectorMappingsListByConnector {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

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

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            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)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(ConnectorMappingListResultData?.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 (ConnectorMappingListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: ConnectorMappingListResultData?, 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.

// Connectors is the the Azure Customer Insights management API provides a RESTful set of web services that interact
// with Azure Customer Insights service to manage your resources. The API has entities that capture the relationship
// between an end user and the Azure Customer Insights service.
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Connectors {
    public static func CreateOrUpdate(resourceGroupName: String, hubName: String, connectorName: String, subscriptionId: String, parameters: ConnectorResourceFormatProtocol) -> ConnectorsCreateOrUpdate {
        return CreateOrUpdateCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, subscriptionId: subscriptionId, parameters: parameters)
    }
    public static func Delete(resourceGroupName: String, hubName: String, connectorName: String, subscriptionId: String) -> ConnectorsDelete {
        return DeleteCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, subscriptionId: subscriptionId)
    }
    public static func Get(resourceGroupName: String, hubName: String, connectorName: String, subscriptionId: String) -> ConnectorsGet {
        return GetCommand(resourceGroupName: resourceGroupName, hubName: hubName, connectorName: connectorName, subscriptionId: subscriptionId)
    }
    public static func ListByHub(resourceGroupName: String, hubName: String, subscriptionId: String) -> ConnectorsListByHub {
        return ListByHubCommand(resourceGroupName: resourceGroupName, hubName: hubName, subscriptionId: subscriptionId)
    }
}
}


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

extension Commands.Connectors {
// CreateOrUpdate creates a connector or updates an existing connector in the hub. 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 CreateOrUpdateCommand : BaseCommand, ConnectorsCreateOrUpdate {
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"
    public var parameters :  ConnectorResourceFormatProtocol?

        public init(resourceGroupName: String, hubName: String, connectorName: String, subscriptionId: String, parameters: ConnectorResourceFormatProtocol) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.connectorName = connectorName
            self.subscriptionId = subscriptionId
            self.parameters = parameters
            super.init()
            self.method = "Put"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            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? ConnectorResourceFormatData)
                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(ConnectorResourceFormatData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ConnectorResourceFormatProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ConnectorResourceFormatData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


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

extension Commands.Connectors {
// Delete deletes a connector in the hub. 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, ConnectorsDelete {
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

        public init(resourceGroupName: String, hubName: String, connectorName: String, subscriptionId: String) {
            self.resourceGroupName = resourceGroupName
            self.hubName = hubName
            self.connectorName = connectorName
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/connectors/{connectorName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            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.executeAsyncLRO(command: self) {
                (error) in
                completionHandler(error)
            }
        }
    }
}


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

extension Commands.Connectors {
// Get gets a connector in the hub.
    internal class GetCommand : BaseCommand, ConnectorsGet {
        public var resourceGroupName : String
        public var hubName : String
        public var connectorName : String
        public var subscriptionId : String
        public var apiVersion = "2017-04-26"

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

        public override func preCall()  {
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{hubName}"] = String(describing: self.hubName)
            self.pathParameters["{connectorName}"] = String(describing: self.connectorName)
            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(ConnectorResourceFormatData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ConnectorResourceFormatProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ConnectorResourceFormatData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}