github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/apigw/v2/domain/Create.go (about) 1 package domain 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 ) 8 9 type CreateOpts struct { 10 GatewayID string `json:"-"` 11 GroupID string `json:"-"` 12 // Minimum SSL version. TLS 1.1 and TLS 1.2 are supported. 13 MinSslVersion string `json:"min_ssl_version,omitempty"` 14 // Whether to enable HTTP redirection to HTTPS. 15 // The value false means disable and true means enable. The default value is false. 16 IsHttpRedirectToHttps *bool `json:"is_http_redirect_to_https,omitempty"` 17 // Custom domain name. 18 // It can contain a maximum of 255 characters and must comply with domain name specifications. 19 UrlDomain string `json:"url_domain" required:"true"` 20 } 21 22 func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*DomainResp, error) { 23 b, err := build.RequestBody(opts, "") 24 if err != nil { 25 return nil, err 26 } 27 28 // POST /v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains 29 raw, err := client.Post(client.ServiceURL("apigw", "instances", opts.GatewayID, "api-groups", opts.GroupID, "domains"), b, nil, &golangsdk.RequestOpts{ 30 OkCodes: []int{201}, 31 }) 32 if err != nil { 33 return nil, err 34 } 35 36 var res DomainResp 37 38 err = extract.Into(raw.Body, &res) 39 return &res, err 40 } 41 42 type DomainResp struct { 43 // Custom domain name. 44 UrlDomain string `json:"url_domain"` 45 // Domain ID. 46 ID string `json:"id"` 47 // CNAME resolution status. 48 // 1: not resolved 49 // 2: resolving 50 // 3: resolved 51 // 4: resolution failed 52 Status int `json:"status"` 53 // Minimum SSL version supported. 54 MinSslVersion string `json:"min_ssl_version"` 55 // Whether to enable HTTP redirection to HTTPS. 56 // The value false means disable and true means enable. The default value is false. 57 IsHttpRedirectToHttps bool `json:"is_http_redirect_to_https"` 58 // Whether to enable client certificate verification. 59 // This parameter is available only when a certificate is bound. 60 // It is enabled by default if trusted_root_ca exists, and disabled if trusted_root_ca does not exist. 61 VerifiedClientCertificateEnabled bool `json:"verified_client_certificate_enabled"` 62 }