github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/apigw/dedicated/v2/signs/results.go (about) 1 package signs 2 3 import "github.com/chnsz/golangsdk/pagination" 4 5 // Signature is the structure that represents the signature detail. 6 type Signature struct { 7 // The signature ID. 8 ID string `json:"id"` 9 // Signature key name. It can contain letters, digits, and underscores(_) and must start with a letter. 10 Name string `json:"name"` 11 // Signature key type. 12 // + hmac 13 // + basic 14 // + public_key 15 // + aes 16 SignType string `json:"sign_type"` 17 // Signature key. 18 // + For 'hmac' type: The value contains 8 to 32 characters, including letters, digits, underscores (_), and 19 // hyphens (-). It must start with a letter or digit. If not specified, a key is automatically generated. 20 // + For 'basic' type: The value contains 4 to 32 characters, including letters, digits, underscores (_), and 21 // hyphens (-). It must start with a letter. If not specified, a key is automatically generated. 22 // + For 'public_key' type: The value contains 8 to 512 characters, including letters, digits, and special 23 // characters (_-+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a key 24 // is automatically generated. 25 // + For 'aes' type: The value contains 16 characters if the aes-128-cfb algorithm is used, or 32 characters if the 26 // aes-256-cfb algorithm is used. Letters, digits, and special characters (_-!@#$%+/=) are allowed. It must start 27 // with a letter, digit, plus sign (+), or slash (/). If not specified, a key is automatically generated. 28 SignKey string `json:"sign_key"` 29 // Signature secret. 30 // + For 'hmac' type: The value contains 16 to 64 characters. Letters, digits, and special characters (_-!@#$%) are 31 // allowed. It must start with a letter or digit. If not specified, a value is automatically generated. 32 // + For 'basic' type: The value contains 8 to 64 characters. Letters, digits, and special characters (_-!@#$%) are 33 // allowed. It must start with a letter or digit. If not specified, a value is automatically generated. 34 // + For 'public_key' type: The value contains 15 to 2048 characters, including letters, digits, and special 35 // characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a 36 // value is automatically generated. 37 // + For 'aes' type: The value contains 16 characters, including letters, digits, and special 38 // characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a 39 // value is automatically generated. 40 SignSecret string `json:"sign_secret"` 41 // Signature algorithm. Specify a signature algorithm only when using an AES signature key. By default, no algorithm 42 // is used. 43 // + aes-128-cfb 44 // + aes-256-cfb 45 SignAlgorithm string `json:"sign_algorithm"` 46 // The creation time. 47 CreatedAt string `json:"created_at"` 48 // The latest update time. 49 UpdatedAt string `json:"updated_at"` 50 // Number of bound APIs. 51 BindNum int `json:"bind_num"` 52 // Number of custom backends bound. 53 LdapiBindNum int `json:"ldapi_bind_num"` 54 } 55 56 // SignaturePage is a single page maximum result representing a query by offset page. 57 type SignaturePage struct { 58 pagination.OffsetPageBase 59 } 60 61 // IsEmpty checks whether a SignaturePage struct is empty. 62 func (b SignaturePage) IsEmpty() (bool, error) { 63 arr, err := ExtractSignatures(b) 64 return len(arr) == 0, err 65 } 66 67 // ExtractSignatures is a method to extract the list of signatures. 68 func ExtractSignatures(r pagination.Page) ([]Signature, error) { 69 var s []Signature 70 err := r.(SignaturePage).Result.ExtractIntoSlicePtr(&s, "signs") 71 return s, err 72 } 73 74 // BindResp is the structure that represents the API response of the signature binding. 75 type BindResp struct { 76 // The published APIs of the binding relationship. 77 Bindings []SignBindApiInfo `json:"bindings"` 78 } 79 80 // BindPage is a single page maximum result representing a query by offset page. 81 type BindPage struct { 82 pagination.OffsetPageBase 83 } 84 85 // IsEmpty checks whether a BindPage struct is empty. 86 func (b BindPage) IsEmpty() (bool, error) { 87 arr, err := ExtractBindInfos(b) 88 return len(arr) == 0, err 89 } 90 91 // ExtractBindInfos is a method to extract the list of binding details for signature. 92 func ExtractBindInfos(r pagination.Page) ([]SignBindApiInfo, error) { 93 var s []SignBindApiInfo 94 err := r.(BindPage).Result.ExtractIntoSlicePtr(&s, "bindings") 95 return s, err 96 } 97 98 // SignBindApiInfo is the structure that represents the binding details. 99 type SignBindApiInfo struct { 100 // API publish record ID. 101 PublishId string `json:"publish_id"` 102 // The API ID. 103 ID string `json:"api_id"` 104 // Group name to which the API belongs. 105 GroupName string `json:"group_name"` 106 // The time when the API and the signature were bound. 107 BoundAt string `json:"binding_time"` 108 // The environment ID where the API is published. 109 EnvId string `json:"env_id"` 110 // The name of the environment published by the API. 111 EnvName string `json:"env_name"` 112 // The API type. 113 Type int `json:"api_type"` 114 // The API Name. 115 Name string `json:"api_name"` 116 // The binding ID. 117 BindId string `json:"id"` 118 // The API type. 119 Description string `json:"api_remark"` 120 // Signature ID. 121 SignId string `json:"sign_id"` 122 // Signature name. 123 SignName string `json:"sign_name"` 124 // Signature key. 125 SignKey string `json:"sign_key"` 126 // Signature secret. 127 SignSecret string `json:"sign_secret"` 128 // Signature type. 129 SignType string `json:"sign_type"` 130 }