github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/cci/v1/networks/results.go (about)

     1  package networks
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type Network struct {
     8  	//API type, fixed value Network
     9  	Kind string `json:"kind"`
    10  	//API version, fixed value networking.cci.io
    11  	ApiVersion string `json:"apiVersion"`
    12  	//Metadata of a Network
    13  	Metadata MetaData `json:"metadata"`
    14  	//Specifications of a Network
    15  	Spec Spec `json:"spec"`
    16  	//Status of a Network
    17  	Status Status `json:"status"`
    18  }
    19  
    20  //Metadata required to create a network
    21  type MetaData struct {
    22  	//Network unique name
    23  	Name string `json:"name"`
    24  	//Network unique Id
    25  	Id string `json:"uid"`
    26  	//Network annotation, key/value pair format
    27  	Annotations map[string]string `json:"annotations"`
    28  }
    29  
    30  type Status struct {
    31  	//The state of the network
    32  	State string `json:"state"`
    33  }
    34  
    35  type commonResult struct {
    36  	golangsdk.Result
    37  }
    38  
    39  // Extract is a function that accepts a result and extracts a network.
    40  func (r commonResult) Extract() (*Network, error) {
    41  	var s Network
    42  	err := r.ExtractInto(&s)
    43  	return &s, err
    44  }
    45  
    46  // CreateResult represents the result of a create operation. Call its Extract
    47  // method to interpret it as a Network.
    48  type CreateResult struct {
    49  	commonResult
    50  }
    51  
    52  // GetResult represents the result of a get operation. Call its Extract
    53  // method to interpret it as a Network.
    54  type GetResult struct {
    55  	commonResult
    56  }
    57  
    58  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    59  // method to determine if the request succeeded or failed.
    60  type DeleteResult struct {
    61  	golangsdk.ErrResult
    62  }