github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/swr/v2/namespaces/results.go (about)

     1  package namespaces
     2  
     3  import (
     4  	"github.com/chnsz/golangsdk"
     5  )
     6  
     7  type Namespace struct {
     8  	// Name of the Namespace
     9  	Name string `json:"name"`
    10  	// Creator Name of the Namespace
    11  	CreatorName string `json:"creator_name"`
    12  	// Auth permission of the Namespace
    13  	Auth int `json:"auth"`
    14  }
    15  
    16  type commonResult struct {
    17  	golangsdk.Result
    18  }
    19  
    20  // Extract is a function that accepts a result and extracts a namespace.
    21  func (r commonResult) Extract() (*Namespace, error) {
    22  	var s Namespace
    23  	err := r.ExtractInto(&s)
    24  	return &s, err
    25  }
    26  
    27  // CreateResult represents the result of a create operation.
    28  type CreateResult struct {
    29  	golangsdk.ErrResult
    30  }
    31  
    32  // GetResult represents the result of a get operation. Call its Extract
    33  // method to interpret it as a Network.
    34  type GetResult struct {
    35  	commonResult
    36  }
    37  
    38  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    39  // method to determine if the request succeeded or failed.
    40  type DeleteResult struct {
    41  	golangsdk.ErrResult
    42  }
    43  
    44  type Access struct {
    45  	// ID of the access
    46  	ID int `json:"id"`
    47  	// Name of the Namespace
    48  	Name string `json:"name"`
    49  	// Creator Name of the Namespace
    50  	CreatorName string `json:"creator_name"`
    51  	// Permission of current user
    52  	SelfAuth User `json:"self_auth"`
    53  	// Permission of other users
    54  	OthersAuths []User `json:"others_auths"`
    55  }
    56  
    57  type CreateAccessResult struct {
    58  	golangsdk.ErrResult
    59  }
    60  
    61  type GetAccessResult struct {
    62  	commonResult
    63  }
    64  
    65  type DeleteAccessResult struct {
    66  	golangsdk.ErrResult
    67  }
    68  
    69  func (r GetAccessResult) Extract() (*Access, error) {
    70  	var s Access
    71  	err := r.ExtractInto(&s)
    72  	return &s, err
    73  }