github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dms/v1/topics/results.go (about)

     1  package topics
     2  
     3  import golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     4  
     5  type CreateResult struct {
     6  	golangsdk.Result
     7  }
     8  
     9  type GetResult struct {
    10  	golangsdk.Result
    11  }
    12  
    13  type DeleteResult struct {
    14  	golangsdk.Result
    15  }
    16  
    17  type TopicName struct {
    18  	Name string `json:"id"`
    19  }
    20  
    21  type Topic struct {
    22  	Size             int          `json:"size"`
    23  	RemainPartitions int          `json:"remain_partitions"`
    24  	MaxPartitions    int          `json:"max_partitions"`
    25  	Topics           []Parameters `json:"topics"`
    26  }
    27  
    28  type Parameters struct {
    29  	Name             string `json:"id"`
    30  	Partition        int    `json:"partition"`
    31  	Replication      int    `json:"replication"`
    32  	SyncReplication  string `json:"sync_replication"`
    33  	RetentionTime    int    `json:"retention_time"`
    34  	SyncMessageFlush string `json:"sync_message_flush"`
    35  }
    36  
    37  func (r CreateResult) Extract() (*TopicName, error) {
    38  	s := new(TopicName)
    39  	err := r.ExtractIntoStructPtr(s, "")
    40  	if err != nil {
    41  		return nil, err
    42  	}
    43  	return s, nil
    44  }
    45  
    46  func (r GetResult) Extract() (*Topic, error) {
    47  	s := new(Topic)
    48  	err := r.ExtractIntoStructPtr(s, "")
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return s, nil
    53  }
    54  
    55  type TopicDelete struct {
    56  	Name    string `json:"id"`
    57  	Success bool   `json:"success"`
    58  }
    59  
    60  func (r DeleteResult) Extract() ([]TopicDelete, error) {
    61  	var s []TopicDelete
    62  	err := r.ExtractIntoSlicePtr(&s, "topics")
    63  	if err != nil {
    64  		return nil, err
    65  	}
    66  	return s, nil
    67  }