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

     1  package repositories
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type UpdateOpts struct {
     9  	// Organization name.
    10  	Namespace string `json:"-"`
    11  	// Image repository name.
    12  	Repository string `json:"-"`
    13  	// Repository type.
    14  	// The value can be app_server, linux, framework_app, database, lang, other, windows or arm.
    15  	Category string `json:"category,omitempty"`
    16  	// Repository description.
    17  	Description string `json:"description,omitempty"`
    18  	// Whether the repository is a public repository. The value can be either true or false.
    19  	IsPublic bool `json:"is_public"`
    20  }
    21  
    22  func Update(client *golangsdk.ServiceClient, opts UpdateOpts) (err error) {
    23  	b, err := build.RequestBody(opts, "")
    24  	if err != nil {
    25  		return
    26  	}
    27  
    28  	// PATCH /v2/manage/namespaces/{namespace}/repos/{repository}
    29  	_, err = client.Patch(client.ServiceURL("manage", "namespaces", opts.Namespace, "repos", opts.Repository), b, nil, &golangsdk.RequestOpts{
    30  		OkCodes: []int{201},
    31  	})
    32  	return
    33  }