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

     1  package blockchains
     2  
     3  import "github.com/huaweicloud/golangsdk"
     4  
     5  type commonResult struct {
     6  	golangsdk.Result
     7  }
     8  
     9  //CreateResult is a struct that represents the result of CreateNewBlockchain
    10  type CreateResult struct {
    11  	commonResult
    12  }
    13  
    14  type CreateResponse struct {
    15  	ID   string `json:"blockchain_id"`
    16  	Name string `json:"blockchain_name"`
    17  }
    18  
    19  func (r CreateResult) Extract() (*CreateResponse, error) {
    20  	var res CreateResponse
    21  	err := r.ExtractInto(&res)
    22  	return &res, err
    23  }
    24  
    25  //DeleteResult is a struct that represents the result of DeleteBlockchain
    26  type DeleteResult struct {
    27  	commonResult
    28  }
    29  
    30  func (r DeleteResult) Extract() error {
    31  	return r.Err
    32  }
    33  
    34  //ShowResult is a struct that represents the result of ShowBlockchainDetail
    35  type ShowResult struct {
    36  	commonResult
    37  }
    38  
    39  type BCSInstance struct {
    40  	Basic      Basic     `json:"basic_info"`
    41  	Channels   []Channel `json:"channels"`
    42  	Peer       []Peer    `json:"peer_info"`
    43  	LightPeer  []Peer    `json:"loght_peer_info"`
    44  	Orderer    Peer      `json:"orderer_info"`
    45  	CouchDB    CouchDB   `json:"couch_db_info"`
    46  	DMSKafka   DMSKafka  `json:"dms_kafka_info"`
    47  	IEF        IEF       `json:"ief_info"`
    48  	SFS        SFS       `json:"sfs_info"`
    49  	Agent      Peer      `json:"agent_info"`
    50  	RestfulAPI Peer      `json:"restapi_info"`
    51  	PVC        PVC       `json:"evs_pvc_info"`
    52  	TaskServer Peer      `json:"tc3_taskserver_info"`
    53  	OBS        OBS       `json:"obs_bucket_info"`
    54  }
    55  
    56  type Basic struct {
    57  	ID                       string       `json:"id"`
    58  	Name                     string       `json:"name"`
    59  	KernelType               string       `json:"kernel_type"`
    60  	Version                  string       `json:"version"`
    61  	VersionType              int          `json:"version_type"`
    62  	VolumeType               string       `json:"volume_type"`
    63  	ServiceType              string       `json:"service_type"`
    64  	PurchaseType             string       `json:"purchase_type"`
    65  	SignAlgorithm            string       `json:"sign_algorithm"`
    66  	Consensus                string       `json:"consensus"`
    67  	ChargingMode             int          `json:"charging_mode"`
    68  	DatabaseType             string       `json:"database_type"`
    69  	ClusterID                string       `json:"cluster_id"`
    70  	ClusterName              string       `json:"cluster_name"`
    71  	ClusterType              string       `json:"cluster_type"`
    72  	ClusterPlatformType      string       `json:"cluster_platform_type"`
    73  	ClusterAvailabilityZone  string       `json:"cluster_az"`
    74  	CreatedTime              string       `json:"created_time"`
    75  	DeployType               string       `json:"deploy_type"`
    76  	DeployScale              int          `json:"deploy_scale"`
    77  	DeployStatus             int          `json:"deploy_status"`
    78  	DetailStatus             DetailStatus `json:"detail_status"`
    79  	IsCrossRegion            bool         `json:"is_cross_region"`
    80  	IsSupportRollback        bool         `json:"is_support_rollback"`
    81  	IsSupportRestful         bool         `json:"is_support_restful"`
    82  	IsSupportTc3             bool         `json:"is_support_tc3"`
    83  	IsOldService             bool         `json:"is_old_service"`
    84  	OldServiceVersion        string       `json:"old_service_version"`
    85  	AgentPortalAddress       []string     `json:"agent_portal_addrs"`
    86  	Status                   string       `json:"status"`
    87  	ProcessStatus            string       `json:"process_status"`
    88  	Tc3TaskServerPortalAddrs []string     `json:"tc3_taskserver_portal_addrs"`
    89  	TotalDeployPeer          int          `json:"total_deploy_peer"`
    90  	OrderStatus              int          `json:"order_status"`
    91  	OrderInfo                OrderInfo    `json:"order_info"`
    92  	OrderFadeCache           int          `json:"order_fade_cache"`
    93  	OrderFadeEnable          bool         `json:"order_fade_enable"`
    94  	IEFClusterInfo           IEFCluster   `json:"ief_cluster_info"`
    95  	IEFAPIVersion            string       `json:"iefapi_version"`
    96  }
    97  
    98  type Channel struct {
    99  	Name        string              `json:"name"`
   100  	OrgNames    []string            `json:"org_names"`
   101  	OrgNameHash []string            `json:"org_name_hash"`
   102  	Peers       map[string][]string `json:"peers"`
   103  }
   104  
   105  type Peer struct {
   106  	Name         string        `json:"name"`
   107  	NodeCount    int           `json:"node_cnt"`
   108  	Status       string        `json:"status"`
   109  	StatusDetail string        `json:"status_detail"`
   110  	PVCName      string        `json:"pvc_name"`
   111  	Address      []PeerAddress `json:"address"`
   112  }
   113  
   114  type PeerAddress struct {
   115  	DomainPort string `json:"domain_port"`
   116  	IPPort     string `json:"ip_port"`
   117  }
   118  
   119  type CouchDB struct {
   120  	User string `json:"user"`
   121  }
   122  
   123  type DMSKafka struct {
   124  	Address         []string `json:"addr"`
   125  	Name            string   `json:"name"`
   126  	Status          string   `json:"status"`
   127  	NodeCount       int      `json:"node_cnt"`
   128  	OrderFadeEnable bool     `json:"order_fade_enable"`
   129  	OrderFadeCache  int      `json:"order_fade_cache"`
   130  }
   131  
   132  type IEF struct {
   133  	DeployMode int `json:"deploy_mode"`
   134  }
   135  
   136  type IEFCluster struct {
   137  	GroupID      string `json:"group_id"`
   138  	GroupName    string `json:"group_name"`
   139  	InstanceID   string `json:"instance_id"`
   140  	InstanceName string `json:"instance_name"`
   141  }
   142  
   143  type SFS struct {
   144  	Name    string `json:"name"`
   145  	PVCName string `json:"pvc_name"`
   146  	Address string `json:"addr"`
   147  	Type    string `json:"type"`
   148  }
   149  
   150  type PVC struct {
   151  	DeployMode int `json:"deploy_mode"`
   152  }
   153  
   154  type OBS struct {
   155  	Name    string `json:"name"`
   156  	Address string `json:"addr"`
   157  }
   158  
   159  type DetailStatus struct {
   160  	AgentStatus     string `json:"agent_status"`
   161  	ConsensusStatus string `json:"consensus_status"`
   162  	OrgStatus       string `json:"org_status"`
   163  	PeerStatus      string `json:"peer_status"`
   164  	PluginStatus    string `json:"plugin_status"`
   165  }
   166  
   167  type OrderInfo struct {
   168  	Delete            int    `json:"delete"`
   169  	Operate           int    `json:"operate"`
   170  	OrderID           string `json:"order_id"`
   171  	OrderStatus       int    `json:"order_status"`
   172  	OrderType         int    `json:"order_type"`
   173  	Release           int    `json:"release"`
   174  	ResourceErrorCode string `json:"resource_error_code"`
   175  	ResourceStatus    int    `json:"resource_status"`
   176  }
   177  
   178  func (r ShowResult) Extract() (*BCSInstance, error) {
   179  	var res BCSInstance
   180  	err := r.ExtractInto(&res)
   181  	return &res, err
   182  }
   183  
   184  //ListResult is a struct that represents the result of ListBlockchain
   185  type ListResult struct {
   186  	commonResult
   187  }
   188  
   189  type BlockChain struct {
   190  	ID   string `json:"id"`
   191  	Name string `json:"name"`
   192  }
   193  
   194  func (r ListResult) Extract() (*[]BlockChain, error) {
   195  	var s struct {
   196  		BlockChains []BlockChain `json:"blockchains"`
   197  	}
   198  	err := r.ExtractInto(&s)
   199  	return &s.BlockChains, err
   200  }
   201  
   202  //StatusResult is a struct that represents the result of ShowBlockchainStatus
   203  type StatusResult struct {
   204  	commonResult
   205  }
   206  
   207  type Status struct {
   208  	BCSStatus   StatusDetail `json:"bcs"`
   209  	EIPStatus   StatusDetail `json:"eip"`
   210  	SFSStatus   StatusDetail `json:"sfs"`
   211  	OBSStatus   StatusDetail `json:"obs"`
   212  	KafkaStatus StatusDetail `json:"kafka"`
   213  	CCEStatus   CCEEngine    `json:"cce"`
   214  }
   215  
   216  type CCEEngine struct {
   217  	Cluster       StatusDetail `json:"cluster"`
   218  	Network       StatusDetail `json:"network"`
   219  	SecurityGroup StatusDetail `json:"security_group"`
   220  }
   221  
   222  type StatusDetail struct {
   223  	StartTime string `json:"start_time"`
   224  	EndTime   string `json:"end_time"`
   225  	Status    string `json:"status"`
   226  	Detail    string `json:"detail"`
   227  }
   228  
   229  func (r StatusResult) Extract() (*Status, error) {
   230  	var s Status
   231  	err := r.ExtractInto(&s)
   232  	return &s, err
   233  }
   234  
   235  //NodesResult is a struct that represents the result of ShowBlockchainNode
   236  type NodesResult struct {
   237  	commonResult
   238  }
   239  
   240  type Org struct {
   241  	OrgMSPID  string          `json:"org_msp_id"`
   242  	OrgDomain string          `json:"org_domain"`
   243  	Peers     map[string]Node `json:"peers"`
   244  }
   245  
   246  type Node struct {
   247  	Port     string   `json:"ip_port"`
   248  	Channels []string `json:"channels"`
   249  }
   250  
   251  func (r NodesResult) Extract() (*map[string]Org, error) {
   252  	var s struct {
   253  		NodeOrgs map[string]Org `json:"node_orgs"`
   254  	}
   255  	err := r.ExtractInto(&s)
   256  	return &s.NodeOrgs, err
   257  }
   258  
   259  //UpdateResult is a struct which represents the result of UpdateBlockchain
   260  type UpdateResult struct {
   261  	commonResult
   262  }
   263  
   264  func (r UpdateResult) Extract() error {
   265  	return r.Err
   266  }