/* Copyright 2018 JDCLOUD.COM

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http:#www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Resource-Tag-APIs
   资源标签接口

   OpenAPI spec version: v1
   Contact: 

   NOTE: This class is auto generated by the jdcloud code generator program.
 */


import Foundation
import JDCloudSDKCore

/// 根据标签查找资源。 &lt;br/&gt;
      ///       /// 若要查找cdn产品线的资源则url中的regionId必须指定为cn-all。
      ///       ///  
public class QueryResourceResult:NSObject,JdCloudResult
{
    /// 资源id集合
    var resourceIds:[String?]?



    public override init(){
        super.init()
    }

    enum QueryResourceResultCodingKeys: String, CodingKey {
        case resourceIds
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: QueryResourceResultCodingKeys.self)
        if decoderContainer.contains(.resourceIds)
        {
            self.resourceIds = try decoderContainer.decode([String?]?.self, forKey: .resourceIds)
        }
    }
}
public extension QueryResourceResult{
    func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: QueryResourceResultCodingKeys.self)
        try encoderContainer.encode(resourceIds, forKey: .resourceIds)
    }
}

///  获取资源标签。&lt;br/&gt;
      ///       /// 注意查询cdn资源的标签时url中regionId必须指定为cn-all。&lt;br/&gt;
      ///       /// 注意查询不限制地域时url中regionId必须指定为all-region。
      ///       /// 
public class DescribeTagsRequest:JdCloudRequest
{
    /// 标签参数
    var tagKeysVo:TagsReqVo


    public init(regionId: String,tagKeysVo:TagsReqVo){
        self.tagKeysVo = tagKeysVo
        super.init(regionId: regionId)
    }


    enum DescribeTagsRequestRequestCodingKeys: String, CodingKey {
        case tagKeysVo
    }

    public override func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: DescribeTagsRequestRequestCodingKeys.self)
        try encoderContainer.encode(tagKeysVo, forKey: .tagKeysVo)

    }
}

public class QueryResourceResponse:NSObject,Codable
{
    var requestId:String?;

    var error:ServiceError?;

    var result:QueryResourceResult?;

    enum QueryResourceResponseCodingKeys: String, CodingKey {
        case requestId
        case error
        case result
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: QueryResourceResponseCodingKeys.self)
        self.requestId = try decoderContainer.decodeIfPresent(String?.self, forKey: .requestId) ?? nil
        self.error = try decoderContainer.decodeIfPresent(ServiceError?.self, forKey: .error) ?? nil
        self.result = try decoderContainer.decodeIfPresent(QueryResourceResult?.self, forKey: .result) ?? nil
    }
}

public extension QueryResourceResponse{
        func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: QueryResourceResponseCodingKeys.self)
        try encoderContainer.encode(requestId, forKey: .requestId)
        try encoderContainer.encode(error, forKey: .error)
        try encoderContainer.encode(result, forKey: .result)
    }
}    
public class DescribeTagsResponse:NSObject,Codable
{
    var requestId:String?;

    var error:ServiceError?;

    var result:DescribeTagsResult?;

    enum DescribeTagsResponseCodingKeys: String, CodingKey {
        case requestId
        case error
        case result
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: DescribeTagsResponseCodingKeys.self)
        self.requestId = try decoderContainer.decodeIfPresent(String?.self, forKey: .requestId) ?? nil
        self.error = try decoderContainer.decodeIfPresent(ServiceError?.self, forKey: .error) ?? nil
        self.result = try decoderContainer.decodeIfPresent(DescribeTagsResult?.self, forKey: .result) ?? nil
    }
}

public extension DescribeTagsResponse{
        func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: DescribeTagsResponseCodingKeys.self)
        try encoderContainer.encode(requestId, forKey: .requestId)
        try encoderContainer.encode(error, forKey: .error)
        try encoderContainer.encode(result, forKey: .result)
    }
}    

///  资源标签绑定。&lt;br/&gt;
      ///       /// 注意cdn资源绑定标签时url中regionId必须指定为cn-all。
      ///       /// 
public class TagResourcesRequest:JdCloudRequest
{
    /// 绑定标签参数
    var tagResources:TagResourcesReqVo


    public init(regionId: String,tagResources:TagResourcesReqVo){
        self.tagResources = tagResources
        super.init(regionId: regionId)
    }


    enum TagResourcesRequestRequestCodingKeys: String, CodingKey {
        case tagResources
    }

    public override func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: TagResourcesRequestRequestCodingKeys.self)
        try encoderContainer.encode(tagResources, forKey: .tagResources)

    }
}

public class DescribeResourcesResponse:NSObject,Codable
{
    var requestId:String?;

    var error:ServiceError?;

    var result:DescribeResourcesResult?;

    enum DescribeResourcesResponseCodingKeys: String, CodingKey {
        case requestId
        case error
        case result
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: DescribeResourcesResponseCodingKeys.self)
        self.requestId = try decoderContainer.decodeIfPresent(String?.self, forKey: .requestId) ?? nil
        self.error = try decoderContainer.decodeIfPresent(ServiceError?.self, forKey: .error) ?? nil
        self.result = try decoderContainer.decodeIfPresent(DescribeResourcesResult?.self, forKey: .result) ?? nil
    }
}

public extension DescribeResourcesResponse{
        func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: DescribeResourcesResponseCodingKeys.self)
        try encoderContainer.encode(requestId, forKey: .requestId)
        try encoderContainer.encode(error, forKey: .error)
        try encoderContainer.encode(result, forKey: .result)
    }
}    

///  根据标签查找资源。 &lt;br/&gt;
      ///       /// 若要查找cdn产品线的资源则url中的regionId必须指定为cn-all。
      ///       /// 
public class QueryResourceRequest:JdCloudRequest
{
    /// 查找资源id的参数对象
    var queryResource:QueryResourceReqVo


    public init(regionId: String,queryResource:QueryResourceReqVo){
        self.queryResource = queryResource
        super.init(regionId: regionId)
    }


    enum QueryResourceRequestRequestCodingKeys: String, CodingKey {
        case queryResource
    }

    public override func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: QueryResourceRequestRequestCodingKeys.self)
        try encoderContainer.encode(queryResource, forKey: .queryResource)

    }
}

public class TagResourcesResponse:NSObject,Codable
{
    var requestId:String?;

    var error:ServiceError?;

    var result:TagResourcesResult?;

    enum TagResourcesResponseCodingKeys: String, CodingKey {
        case requestId
        case error
        case result
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: TagResourcesResponseCodingKeys.self)
        self.requestId = try decoderContainer.decodeIfPresent(String?.self, forKey: .requestId) ?? nil
        self.error = try decoderContainer.decodeIfPresent(ServiceError?.self, forKey: .error) ?? nil
        self.result = try decoderContainer.decodeIfPresent(TagResourcesResult?.self, forKey: .result) ?? nil
    }
}

public extension TagResourcesResponse{
        func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: TagResourcesResponseCodingKeys.self)
        try encoderContainer.encode(requestId, forKey: .requestId)
        try encoderContainer.encode(error, forKey: .error)
        try encoderContainer.encode(result, forKey: .result)
    }
}    
/// 获得资源与对应标签列表详情，不含资源名称和可用区。&lt;br/&gt;
      ///       /// 注意查询cdn的资源时url中regionId必须指定为cn-all。&lt;br/&gt;
      ///       /// 该接口目前不支持分页功能。
      ///       ///  
public class DescribeResourcesResult:NSObject,JdCloudResult
{
    /// 资源与对应标签列表详情
    var data:ResourceResVo?



    public override init(){
        super.init()
    }

    enum DescribeResourcesResultCodingKeys: String, CodingKey {
        case data
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: DescribeResourcesResultCodingKeys.self)
        if decoderContainer.contains(.data)
        {
            self.data = try decoderContainer.decode(ResourceResVo?.self, forKey: .data)
        }
    }
}
public extension DescribeResourcesResult{
    func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: DescribeResourcesResultCodingKeys.self)
        try encoderContainer.encode(data, forKey: .data)
    }
}

///  资源标签解绑。&lt;br/&gt;
      ///       /// 注意cdn资源解绑标签时url中regionId必须指定为cn-all。
      ///       /// 
public class UnTagResourcesRequest:JdCloudRequest
{
    /// 解绑标签参数
    var unTagResources:UnTagResourcesReqVo


    public init(regionId: String,unTagResources:UnTagResourcesReqVo){
        self.unTagResources = unTagResources
        super.init(regionId: regionId)
    }


    enum UnTagResourcesRequestRequestCodingKeys: String, CodingKey {
        case unTagResources
    }

    public override func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: UnTagResourcesRequestRequestCodingKeys.self)
        try encoderContainer.encode(unTagResources, forKey: .unTagResources)

    }
}


///  获得资源与对应标签列表详情，不含资源名称和可用区。&lt;br/&gt;
      ///       /// 注意查询cdn的资源时url中regionId必须指定为cn-all。&lt;br/&gt;
      ///       /// 该接口目前不支持分页功能。
      ///       /// 
public class DescribeResourcesRequest:JdCloudRequest
{
    /// 资源标签参数对象
    var resourceVo:ResourceReqVo


    public init(regionId: String,resourceVo:ResourceReqVo){
        self.resourceVo = resourceVo
        super.init(regionId: regionId)
    }


    enum DescribeResourcesRequestRequestCodingKeys: String, CodingKey {
        case resourceVo
    }

    public override func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: DescribeResourcesRequestRequestCodingKeys.self)
        try encoderContainer.encode(resourceVo, forKey: .resourceVo)

    }
}

/// 资源标签绑定。&lt;br/&gt;
      ///       /// 注意cdn资源绑定标签时url中regionId必须指定为cn-all。
      ///       ///  
public class TagResourcesResult:NSObject,JdCloudResult
{
    /// 资源标签绑定结果详情
    var data:TagResourcesResVo?



    public override init(){
        super.init()
    }

    enum TagResourcesResultCodingKeys: String, CodingKey {
        case data
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: TagResourcesResultCodingKeys.self)
        if decoderContainer.contains(.data)
        {
            self.data = try decoderContainer.decode(TagResourcesResVo?.self, forKey: .data)
        }
    }
}
public extension TagResourcesResult{
    func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: TagResourcesResultCodingKeys.self)
        try encoderContainer.encode(data, forKey: .data)
    }
}
/// 资源标签解绑。&lt;br/&gt;
      ///       /// 注意cdn资源解绑标签时url中regionId必须指定为cn-all。
      ///       ///  
public class UnTagResourcesResult:NSObject,JdCloudResult
{
    /// 资源标签解绑结果详情
    var data:UnTagResourcesResVo?



    public override init(){
        super.init()
    }

    enum UnTagResourcesResultCodingKeys: String, CodingKey {
        case data
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: UnTagResourcesResultCodingKeys.self)
        if decoderContainer.contains(.data)
        {
            self.data = try decoderContainer.decode(UnTagResourcesResVo?.self, forKey: .data)
        }
    }
}
public extension UnTagResourcesResult{
    func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: UnTagResourcesResultCodingKeys.self)
        try encoderContainer.encode(data, forKey: .data)
    }
}
/// 获取资源标签。&lt;br/&gt;
      ///       /// 注意查询cdn资源的标签时url中regionId必须指定为cn-all。&lt;br/&gt;
      ///       /// 注意查询不限制地域时url中regionId必须指定为all-region。
      ///       ///  
public class DescribeTagsResult:NSObject,JdCloudResult
{
    /// 获取标签结果详情
    var data:TagsResVo?



    public override init(){
        super.init()
    }

    enum DescribeTagsResultCodingKeys: String, CodingKey {
        case data
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: DescribeTagsResultCodingKeys.self)
        if decoderContainer.contains(.data)
        {
            self.data = try decoderContainer.decode(TagsResVo?.self, forKey: .data)
        }
    }
}
public extension DescribeTagsResult{
    func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: DescribeTagsResultCodingKeys.self)
        try encoderContainer.encode(data, forKey: .data)
    }
}
public class UnTagResourcesResponse:NSObject,Codable
{
    var requestId:String?;

    var error:ServiceError?;

    var result:UnTagResourcesResult?;

    enum UnTagResourcesResponseCodingKeys: String, CodingKey {
        case requestId
        case error
        case result
    }

    required public init(from decoder: Decoder) throws {
        let decoderContainer = try decoder.container(keyedBy: UnTagResourcesResponseCodingKeys.self)
        self.requestId = try decoderContainer.decodeIfPresent(String?.self, forKey: .requestId) ?? nil
        self.error = try decoderContainer.decodeIfPresent(ServiceError?.self, forKey: .error) ?? nil
        self.result = try decoderContainer.decodeIfPresent(UnTagResourcesResult?.self, forKey: .result) ?? nil
    }
}

public extension UnTagResourcesResponse{
        func encode(to encoder: Encoder) throws {
        var encoderContainer = encoder.container(keyedBy: UnTagResourcesResponseCodingKeys.self)
        try encoderContainer.encode(requestId, forKey: .requestId)
        try encoderContainer.encode(error, forKey: .error)
        try encoderContainer.encode(result, forKey: .result)
    }
}    
