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

     1  package repositories
     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  	Namespace string `json:"-"`
    11  	// Image repository name.
    12  	// Enter 1 to 128 characters, starting and ending with a lowercase letter or digit. Only lowercase letters, digits, periods (.), slashes (/), underscores (_), and hyphens (-) are allowed. Periods, slashes, underscores, and hyphens cannot be placed next to each other. A maximum of two consecutive underscores are allowed.
    13  	Repository string `json:"repository"`
    14  	// Repository type.
    15  	// The value can be app_server, linux, framework_app, database, lang, other, windows or arm.
    16  	Category string `json:"category,omitempty"`
    17  	// Brief description of the image repository.
    18  	Description string `json:"description,omitempty"`
    19  	// Whether the repository is a public repository. When the value is true, it indicates the repository is public. When the value is false, it indicates the repository is private.
    20  	IsPublic bool `json:"is_public"`
    21  }
    22  
    23  // Create new repository in the organization (namespace)
    24  func Create(client *golangsdk.ServiceClient, opts CreateOpts) (err error) {
    25  	b, err := build.RequestBody(opts, "")
    26  	if err != nil {
    27  		return
    28  	}
    29  
    30  	// POST /v2/manage/namespaces/{namespace}/repos
    31  	_, err = client.Post(client.ServiceURL("manage", "namespaces", opts.Namespace, "repos"), b, nil, nil)
    32  	return
    33  }