github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/apigw/v2/domain/Update.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 UpdateOpts struct {
    10  	GatewayID string `json:"-"`
    11  	GroupID   string `json:"-"`
    12  	DomainID  string `json:"-"`
    13  	// Minimum SSL version. TLS 1.1 and TLS 1.2 are supported.
    14  	MinSslVersion string `json:"min_ssl_version" required:"true"`
    15  	// Whether to enable HTTP redirection to HTTPS.
    16  	// The value false means disable and true means enable. The default value is false.
    17  	IsHttpRedirectToHttps *bool `json:"is_http_redirect_to_https,omitempty"`
    18  	// Whether to enable client certificate verification.
    19  	// This parameter is available only when a certificate is bound.
    20  	// It is enabled by default if trusted_root_ca exists, and disabled if trusted_root_ca does not exist.
    21  	VerifiedClientCertificateEnabled *bool `json:"verified_client_certificate_enabled,omitempty"`
    22  }
    23  
    24  func Update(client *golangsdk.ServiceClient, opts UpdateOpts) (*DomainResp, error) {
    25  	b, err := build.RequestBody(opts, "")
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	// PUT /v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains/{domain_id}
    31  	raw, err := client.Put(client.ServiceURL("apigw", "instances", opts.GatewayID, "api-groups", opts.GroupID, "domains", opts.DomainID), b, nil, &golangsdk.RequestOpts{
    32  		OkCodes: []int{201},
    33  	})
    34  	if err != nil {
    35  		return nil, err
    36  	}
    37  
    38  	var res DomainResp
    39  
    40  	err = extract.Into(raw.Body, &res)
    41  	return &res, err
    42  }