CreateDomain.go raw

   1  // Copyright 2018 JDCLOUD.COM
   2  //
   3  // Licensed under the Apache License, Version 2.0 (the "License");
   4  // you may not use this file except in compliance with the License.
   5  // You may obtain a copy of the License at
   6  //
   7  //     http://www.apache.org/licenses/LICENSE-2.0
   8  //
   9  // Unless required by applicable law or agreed to in writing, software
  10  // distributed under the License is distributed on an "AS IS" BASIS,
  11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12  // See the License for the specific language governing permissions and
  13  // limitations under the License.
  14  //
  15  // NOTE: This class is auto generated by the jdcloud code generator program.
  16  
  17  package apis
  18  
  19  import (
  20  	"github.com/go-acme/jdcloud-sdk-go/core"
  21  	domainservice "github.com/go-acme/jdcloud-sdk-go/services/domainservice/models"
  22  )
  23  
  24  type CreateDomainRequest struct {
  25  	core.JDCloudRequest
  26  
  27  	/* 实例所属的地域ID  */
  28  	RegionId string `json:"regionId"`
  29  
  30  	/* 主域名的套餐类型, 免费:0 企业版:1 企业高级版:2  */
  31  	PackId int `json:"packId"`
  32  
  33  	/* 要添加的主域名  */
  34  	DomainName string `json:"domainName"`
  35  
  36  	/* 主域名的ID,升级套餐必填,请使用describeDomains获取 (Optional) */
  37  	DomainId *int `json:"domainId"`
  38  
  39  	/* 新购买:1、升级:3,收费套餐的域名必填 (Optional) */
  40  	BuyType *int `json:"buyType"`
  41  
  42  	/* 取值1,2,3 ,含义:时长,收费套餐的域名必填 (Optional) */
  43  	TimeSpan *int `json:"timeSpan"`
  44  
  45  	/* 时间单位,收费套餐的域名必填,1:小时,2:天,3:月,4:年 (Optional) */
  46  	TimeUnit *int `json:"timeUnit"`
  47  
  48  	/* 计费类型,可以不传此参数。 (Optional) */
  49  	BillingType *int `json:"billingType"`
  50  }
  51  
  52  /*
  53   * param regionId: 实例所属的地域ID (Required)
  54   * param packId: 主域名的套餐类型, 免费:0 企业版:1 企业高级版:2 (Required)
  55   * param domainName: 要添加的主域名 (Required)
  56   *
  57   * @Deprecated, not compatible when mandatory parameters changed
  58   */
  59  func NewCreateDomainRequest(
  60  	regionId string,
  61  	packId int,
  62  	domainName string,
  63  ) *CreateDomainRequest {
  64  
  65  	return &CreateDomainRequest{
  66  		JDCloudRequest: core.JDCloudRequest{
  67  			URL:     "/regions/{regionId}/domain",
  68  			Method:  "POST",
  69  			Header:  nil,
  70  			Version: "v2",
  71  		},
  72  		RegionId:   regionId,
  73  		PackId:     packId,
  74  		DomainName: domainName,
  75  	}
  76  }
  77  
  78  /*
  79   * param regionId: 实例所属的地域ID (Required)
  80   * param packId: 主域名的套餐类型, 免费:0 企业版:1 企业高级版:2 (Required)
  81   * param domainName: 要添加的主域名 (Required)
  82   * param domainId: 主域名的ID,升级套餐必填,请使用describeDomains获取 (Optional)
  83   * param buyType: 新购买:1、升级:3,收费套餐的域名必填 (Optional)
  84   * param timeSpan: 取值1,2,3 ,含义:时长,收费套餐的域名必填 (Optional)
  85   * param timeUnit: 时间单位,收费套餐的域名必填,1:小时,2:天,3:月,4:年 (Optional)
  86   * param billingType: 计费类型,可以不传此参数。 (Optional)
  87   */
  88  func NewCreateDomainRequestWithAllParams(
  89  	regionId string,
  90  	packId int,
  91  	domainName string,
  92  	domainId *int,
  93  	buyType *int,
  94  	timeSpan *int,
  95  	timeUnit *int,
  96  	billingType *int,
  97  ) *CreateDomainRequest {
  98  
  99  	return &CreateDomainRequest{
 100  		JDCloudRequest: core.JDCloudRequest{
 101  			URL:     "/regions/{regionId}/domain",
 102  			Method:  "POST",
 103  			Header:  nil,
 104  			Version: "v2",
 105  		},
 106  		RegionId:    regionId,
 107  		PackId:      packId,
 108  		DomainName:  domainName,
 109  		DomainId:    domainId,
 110  		BuyType:     buyType,
 111  		TimeSpan:    timeSpan,
 112  		TimeUnit:    timeUnit,
 113  		BillingType: billingType,
 114  	}
 115  }
 116  
 117  /* This constructor has better compatible ability when API parameters changed */
 118  func NewCreateDomainRequestWithoutParam() *CreateDomainRequest {
 119  
 120  	return &CreateDomainRequest{
 121  		JDCloudRequest: core.JDCloudRequest{
 122  			URL:     "/regions/{regionId}/domain",
 123  			Method:  "POST",
 124  			Header:  nil,
 125  			Version: "v2",
 126  		},
 127  	}
 128  }
 129  
 130  /* param regionId: 实例所属的地域ID(Required) */
 131  func (r *CreateDomainRequest) SetRegionId(regionId string) {
 132  	r.RegionId = regionId
 133  }
 134  
 135  /* param packId: 主域名的套餐类型, 免费:0 企业版:1 企业高级版:2(Required) */
 136  func (r *CreateDomainRequest) SetPackId(packId int) {
 137  	r.PackId = packId
 138  }
 139  
 140  /* param domainName: 要添加的主域名(Required) */
 141  func (r *CreateDomainRequest) SetDomainName(domainName string) {
 142  	r.DomainName = domainName
 143  }
 144  
 145  /* param domainId: 主域名的ID,升级套餐必填,请使用describeDomains获取(Optional) */
 146  func (r *CreateDomainRequest) SetDomainId(domainId int) {
 147  	r.DomainId = &domainId
 148  }
 149  
 150  /* param buyType: 新购买:1、升级:3,收费套餐的域名必填(Optional) */
 151  func (r *CreateDomainRequest) SetBuyType(buyType int) {
 152  	r.BuyType = &buyType
 153  }
 154  
 155  /* param timeSpan: 取值1,2,3 ,含义:时长,收费套餐的域名必填(Optional) */
 156  func (r *CreateDomainRequest) SetTimeSpan(timeSpan int) {
 157  	r.TimeSpan = &timeSpan
 158  }
 159  
 160  /* param timeUnit: 时间单位,收费套餐的域名必填,1:小时,2:天,3:月,4:年(Optional) */
 161  func (r *CreateDomainRequest) SetTimeUnit(timeUnit int) {
 162  	r.TimeUnit = &timeUnit
 163  }
 164  
 165  /* param billingType: 计费类型,可以不传此参数。(Optional) */
 166  func (r *CreateDomainRequest) SetBillingType(billingType int) {
 167  	r.BillingType = &billingType
 168  }
 169  
 170  // GetRegionId returns path parameter 'regionId' if exist,
 171  // otherwise return empty string
 172  func (r CreateDomainRequest) GetRegionId() string {
 173  	return r.RegionId
 174  }
 175  
 176  type CreateDomainResponse struct {
 177  	RequestID string             `json:"requestId"`
 178  	Error     core.ErrorResponse `json:"error"`
 179  	Result    CreateDomainResult `json:"result"`
 180  }
 181  
 182  type CreateDomainResult struct {
 183  	Data  domainservice.DomainAdded `json:"data"`
 184  	Order string                    `json:"order"`
 185  }
 186