github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/instance/ListDCSStatus.go (about)

     1  package instance
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  type StatusOpts struct {
     9  	// An indicator of whether the number of DCS instances that failed to be created will be returned to the API caller. Options:
    10  	// true: The number of DCS instances that failed to be created will be returned to the API caller.
    11  	// false or others: The number of DCS instances that failed to be created will not be returned to the API caller.
    12  	IncludeFailure *bool `q:"includeFailure"`
    13  }
    14  
    15  func ListDCSStatus(client *golangsdk.ServiceClient, opts StatusOpts) (*ListNumberOfInstancesInDifferentStatusResponse, error) {
    16  	url, err := golangsdk.NewURLBuilder().WithEndpoints("instances", "status").WithQueryParams(&opts).Build()
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	raw, err := client.Get(client.ServiceURL(url.String()), nil, nil)
    22  	if err != nil {
    23  		return nil, err
    24  	}
    25  
    26  	var res ListNumberOfInstancesInDifferentStatusResponse
    27  	err = extract.Into(raw.Body, &res)
    28  	return &res, err
    29  }
    30  
    31  type ListNumberOfInstancesInDifferentStatusResponse struct {
    32  	// Number of instances for which payment is in progress.
    33  	PayingCount int32 `json:"paying_count"`
    34  	// Number of instances for which payment is in progress.
    35  	MigratingCount int32 `json:"migrating_count"`
    36  	// Number of instances whose data is being cleared.
    37  	FlushingCount int32 `json:"flushing_count"`
    38  	// Number of instances that are being upgraded.
    39  	UpgradingCount int32 `json:"upgrading_count"`
    40  	// Number of instances for which data restoration is in progress.
    41  	RestoringCount int32 `json:"restoring_count"`
    42  	// Number of instances that are being scaled up.
    43  	ExtendingCount int32 `json:"extending_count"`
    44  	// Number of instances that are being created.
    45  	CreatingCount int32 `json:"creating_count"`
    46  	// Number of running instances.
    47  	RunningCount int32 `json:"running_count"`
    48  	// Number of abnormal instances.
    49  	ErrorCount int32 `json:"error_count"`
    50  	// Number of instances that fail to be created.
    51  	CreatefailedCount int32 `json:"createfailed_count"`
    52  	// Number of instances that are being restarted.
    53  	RestartingCount int32 `json:"restarting_count"`
    54  	// Number of instances that are being deleted.
    55  	DeletingCount int32 `json:"deleting_count"`
    56  	// Number of instances that have been stopped.
    57  	ClosedCount int32 `json:"closed_count"`
    58  	// Number of instances that are being started.
    59  	StartingCount int32 `json:"starting_count"`
    60  	// Number of instances that are being stopped.
    61  	ClosingCount int32 `json:"closing_count"`
    62  }