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

     1  package organizations
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type Auth struct {
     9  	// User ID, which needs to be obtained from the IAM service.
    10  	UserID string `json:"user_id"`
    11  	// Username, which needs to be obtained from the IAM service.
    12  	Username string `json:"user_name"`
    13  	// User permission
    14  	// 7: Manage
    15  	// 3: Write
    16  	// 1: Read
    17  	Auth int `json:"auth"`
    18  }
    19  
    20  func CreatePermissions(client *golangsdk.ServiceClient, organization string, opts []Auth) (err error) {
    21  	b, err := build.RequestBody(opts, "")
    22  	if err != nil {
    23  		return
    24  	}
    25  
    26  	// POST /v2/manage/namespaces/{namespace}/access
    27  	_, err = client.Post(client.ServiceURL("manage", "namespaces", organization, "access"), b, nil, nil)
    28  	return
    29  }