github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/apigw/v2/applications/results.go (about)

     1  package applications
     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  // GetResult represents a result of the Get operation.
    18  type GetResult struct {
    19  	commonResult
    20  }
    21  
    22  // UpdateResult represents a result of the Update operation.
    23  type UpdateResult struct {
    24  	commonResult
    25  }
    26  
    27  // ResetSecretResult represents a result of the ResetAppSecret operation.
    28  type ResetSecretResult struct {
    29  	commonResult
    30  }
    31  
    32  type Application struct {
    33  	// Creator of the application.
    34  	//     USER: The app is created by the API user.
    35  	//     MARKET: The app is allocated by the marketplace.
    36  	Creator string `json:"creator"`
    37  	// Registraion time.
    38  	RegistraionTime string `json:"register_time"`
    39  	// Update time.
    40  	UpdateTime string `json:"update_time"`
    41  	// App key.
    42  	AppKey string `json:"app_key"`
    43  	// App name.
    44  	Name string `json:"name"`
    45  	// Description.
    46  	Description string `json:"remark"`
    47  	// ID.
    48  	Id string `json:"id"`
    49  	// App secret.
    50  	AppSecret string `json:"app_secret"`
    51  	// App status.
    52  	Status int `json:"status"`
    53  	// App type, Currently only supports 'apig'. List method are not support.
    54  	Type string `json:"app_type"`
    55  	// Number of APIs. Only used for List method.
    56  	BindNum int `json:"bind_num"`
    57  }
    58  
    59  func (r commonResult) Extract() (*Application, error) {
    60  	var s Application
    61  	err := r.ExtractInto(&s)
    62  	return &s, err
    63  }
    64  
    65  // ApplicationPage represents the response pages of the List operation.
    66  type ApplicationPage struct {
    67  	pagination.SinglePageBase
    68  }
    69  
    70  func ExtractApplications(r pagination.Page) ([]Application, error) {
    71  	var s []Application
    72  	err := r.(ApplicationPage).Result.ExtractIntoSlicePtr(&s, "apps")
    73  	return s, err
    74  }
    75  
    76  // DeleteResult represents a result of the Delete method.
    77  type DeleteResult struct {
    78  	golangsdk.ErrResult
    79  }
    80  
    81  type AppCode struct {
    82  	// AppCode value, which contains 64 to 180 characters, starting with a letter, plus sign (+) or slash (/).
    83  	// Only letters and the following special characters are allowed: +-_!@#$%/=
    84  	Code string `json:"app_code"`
    85  	// AppCode ID.
    86  	Id string `json:"id"`
    87  	// App ID.
    88  	AppId string `json:"app_id"`
    89  	// Creation time, in UTC format.
    90  	CreateTime string `json:"create_time"`
    91  }
    92  
    93  // CreateCodeResult represents a result of the CreateAppCode method.
    94  type CreateCodeResult struct {
    95  	CodeResult
    96  }
    97  
    98  // AutoGenerateCodeResult represents a result of the AutoGenerateAppCode method.
    99  type AutoGenerateCodeResult struct {
   100  	CodeResult
   101  }
   102  
   103  // GetCodeResult represents a result of the GetAppCode method.
   104  type GetCodeResult struct {
   105  	CodeResult
   106  }
   107  
   108  type CodeResult struct {
   109  	golangsdk.Result
   110  }
   111  
   112  func (r CodeResult) Extract() (*AppCode, error) {
   113  	var s AppCode
   114  	err := r.ExtractInto(&s)
   115  	return &s, err
   116  }
   117  
   118  // AppCodePage represents the response pages of the ListAppCode operation.
   119  type AppCodePage struct {
   120  	pagination.SinglePageBase
   121  }
   122  
   123  func ExtractAppCodes(r pagination.Page) ([]AppCode, error) {
   124  	var s []AppCode
   125  	err := r.(AppCodePage).Result.ExtractIntoSlicePtr(&s, "app_codes")
   126  	return s, err
   127  }