github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/swr/v2/organizations/Create.go (about)

     1  package organizations
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type CreateOpts struct {
     9  	// Organization name.
    10  	// Enter 1 to 64 characters, starting with a lowercase letter and ending with a lowercase letter or digit. Only lowercase letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. Periods, underscores, and hyphens cannot be placed next to each other. A maximum of two consecutive underscores are allowed.
    11  	Namespace string `json:"namespace"`
    12  }
    13  
    14  func Create(client *golangsdk.ServiceClient, opts CreateOpts) (err error) {
    15  	b, err := build.RequestBody(opts, "")
    16  	if err != nil {
    17  		return
    18  	}
    19  
    20  	// POST /v2/manage/namespaces
    21  	_, err = client.Post(client.ServiceURL("manage", "namespaces"), &b, nil, nil)
    22  	return
    23  }