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

     1  package organizations
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func GetPermissions(client *golangsdk.ServiceClient, organization string) (*Permissions, error) {
     9  	// PATCH /v2/manage/namespaces/{namespace}/access
    10  	raw, err := client.Get(client.ServiceURL("manage", "namespaces", organization, "access"), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res Permissions
    16  	err = extract.Into(raw.Body, &res)
    17  	return &res, err
    18  }
    19  
    20  type Permissions struct {
    21  	// Permission ID.
    22  	ID int `json:"id"`
    23  	// Organization name.
    24  	Name string `json:"name"`
    25  	// Organization creator.
    26  	CreatorName string `json:"creator_name"`
    27  	// Permissions of the current user.
    28  	SelfAuth Auth `json:"self_auth"`
    29  	// Permissions of other users.
    30  	OthersAuth []Auth `json:"others_auths"`
    31  }