github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dis/v2/streams/GetPolicyRule.go (about) 1 package streams 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 func GetPolicyRule(client *golangsdk.ServiceClient, streamName string) (*GetPolicyRuleResponse, error) { 9 // GET /v2/{project_id}/streams/{stream_name}/policies 10 raw, err := client.Get(client.ServiceURL("streams", streamName, "policies"), nil, nil) 11 if err != nil { 12 return nil, err 13 } 14 15 var res GetPolicyRuleResponse 16 err = extract.Into(raw.Body, &res) 17 return &res, err 18 } 19 20 type GetPolicyRuleResponse struct { 21 // Unique ID of the stream. 22 StreamId string `json:"stream_id,omitempty"` 23 // List of authorization information records. 24 Rules []PrincipalRule `json:"rules,omitempty"` 25 } 26 27 type PrincipalRule struct { 28 // ID of the authorized user. 29 Principal string `json:"principal,omitempty"` 30 // Name of the authorized user. 31 // If the permission is granted to all sub-users of a tenant, the format is domainName.*. 32 // If the permission is granted to a specified sub-user of a tenant, the format is domainName.userName. 33 PrincipalName string `json:"principal_name,omitempty"` 34 // Authorization operation type. 35 // - putRecords: the data to be uploaded. 36 // - getRecords: Download data. 37 // Enumeration values: 38 // putRecords 39 // getRecords 40 ActionType string `json:"action_type,omitempty"` 41 // Authorization impact type. 42 // - accept: The authorization operation is allowed. 43 // Enumeration values: 44 // accept 45 Effect string `json:"effect,omitempty"` 46 }