github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/apigw/v2/authorizers/results.go (about) 1 package authorizers 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 "github.com/huaweicloud/golangsdk/pagination" 6 ) 7 8 type commonResult struct { 9 golangsdk.Result 10 } 11 12 // CreateResult represents a result of the Create method. 13 type CreateResult struct { 14 commonResult 15 } 16 17 // UpdateResult represents a result of the Update method. 18 type UpdateResult struct { 19 commonResult 20 } 21 22 // GetResult represents a result of the Update method. 23 type GetResult struct { 24 commonResult 25 } 26 27 // CustomAuthorizer is a struct that represents the result of Create, Update and Get methods. 28 type CustomAuthorizer struct { 29 // Custom authorizer name., which can contain 3 to 64 characters, starting with a letter. 30 // Only letters, digits, and underscores (_) are allowed. 31 Name string `json:"name"` 32 // Custom authorizer type, which support 'FRONTEND' and 'BACKEND'. 33 Type string `json:"type"` 34 // Authorizer type, and the value is 'FUNC'. 35 AuthorizerType string `json:"authorizer_type"` 36 // Function URN. 37 AuthorizerURI string `json:"authorizer_uri"` 38 // Identity source. 39 Identities []Identity `json:"identities"` 40 // Maximum cache age. 41 TTL int `json:"ttl"` 42 // User data. 43 UserData string `json:"user_data"` 44 // Indicates whether to send the body. 45 IsBodySend bool `json:"need_body"` 46 // Custom authorizer ID 47 ID string `json:"id"` 48 // Creation time. 49 CreateTime string `json:"create_time"` 50 } 51 52 // Identity is an object struct that represents the elements of the Identities parameter. 53 type Identity struct { 54 // Parameter name. 55 Name string `json:"name"` 56 // Parameter location, which support 'HEADER' and 'QUERY'. 57 Location string `json:"location"` 58 // Parameter verification expression. 59 // The default value is null, indicating that no verification is performed. 60 Validation string `json:"validation"` 61 } 62 63 func (r commonResult) Extract() (*CustomAuthorizer, error) { 64 var s CustomAuthorizer 65 err := r.ExtractInto(&s) 66 return &s, err 67 } 68 69 // CustomAuthPage represents the response pages of the List method. 70 type CustomAuthPage struct { 71 pagination.SinglePageBase 72 } 73 74 // ExtractCustomAuthorizers is a method which to extract the response to a custom authorizer list. 75 func ExtractCustomAuthorizers(r pagination.Page) ([]CustomAuthorizer, error) { 76 var s []CustomAuthorizer 77 err := r.(CustomAuthPage).Result.ExtractIntoSlicePtr(&s, "authorizer_list") 78 return s, err 79 } 80 81 // DeleteResult represents a result of the Delete method. 82 type DeleteResult struct { 83 golangsdk.ErrResult 84 }