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

     1  package version
     2  
     3  import (
     4  	"github.com/chnsz/golangsdk/openstack/modelarts/v2/dataset"
     5  	"github.com/chnsz/golangsdk/pagination"
     6  )
     7  
     8  type CreateResp struct {
     9  	VersionId string `json:"version_id"`
    10  }
    11  
    12  type DatasetVersion struct {
    13  	AddSampleCount               int                    `json:"add_sample_count"`
    14  	AnalysisCachePath            string                 `json:"analysis_cache_path"`
    15  	AnalysisStatus               int                    `json:"analysis_status"`
    16  	AnalysisTaskId               string                 `json:"analysis_task_id"`
    17  	AnnotatedSampleCount         int                    `json:"annotated_sample_count"`
    18  	AnnotatedSubSampleCount      int                    `json:"annotated_sub_sample_count"`
    19  	ClearHardProperty            bool                   `json:"clear_hard_property"`
    20  	Code                         string                 `json:"code"`
    21  	CreateTime                   int                    `json:"create_time"`
    22  	Crop                         bool                   `json:"crop"`
    23  	CropPath                     string                 `json:"crop_path"`
    24  	CropRotateCachePath          string                 `json:"crop_rotate_cache_path"`
    25  	DataAnalysis                 map[string]interface{} `json:"data_analysis"`
    26  	DataPath                     string                 `json:"data_path"`
    27  	DataStatistics               map[string]interface{} `json:"data_statistics"`
    28  	DataValidate                 bool                   `json:"data_validate"`
    29  	DeletedSampleCount           int                    `json:"deleted_sample_count"`
    30  	DeletionStats                map[string]int         `json:"deletion_stats"`
    31  	Description                  string                 `json:"description"`
    32  	ExportImages                 bool                   `json:"export_images"`
    33  	ExtractSerialNumber          bool                   `json:"extract_serial_number"`
    34  	IncludeDatasetData           bool                   `json:"include_dataset_data"`
    35  	IsCurrent                    bool                   `json:"is_current"`
    36  	LabelStats                   []dataset.Label        `json:"label_stats"`
    37  	LabelType                    string                 `json:"label_type"`
    38  	ManifestCacheInputPath       string                 `json:"manifest_cache_input_path"`
    39  	ManifestPath                 string                 `json:"manifest_path"`
    40  	Message                      string                 `json:"message"`
    41  	ModifiedSampleCount          int                    `json:"modified_sample_count"`
    42  	PreviousAnnotatedSampleCount int                    `json:"previous_annotated_sample_count"`
    43  	PreviousTotalSampleCount     int                    `json:"previous_total_sample_count"`
    44  	PreviousVersionId            string                 `json:"previous_version_id"`
    45  	ProcessorTaskId              string                 `json:"processor_task_id"`
    46  	ProcessorTaskStatus          int                    `json:"processor_task_status"`
    47  	RemoveSampleUsage            bool                   `json:"remove_sample_usage"`
    48  	Rotate                       bool                   `json:"rotate"`
    49  	RotatePath                   string                 `json:"rotate_path"`
    50  	SampleState                  string                 `json:"sample_state"`
    51  	StartProcessorTask           bool                   `json:"start_processor_task"`
    52  	Status                       int                    `json:"status"`
    53  	Tags                         []string               `json:"tags"`
    54  	TaskType                     int                    `json:"task_type"`
    55  	TotalSampleCount             int                    `json:"total_sample_count"`
    56  	TotalSubSampleCount          int                    `json:"total_sub_sample_count"`
    57  	TrainEvaluateSampleRatio     string                 `json:"train_evaluate_sample_ratio"`
    58  	UpdateTime                   int                    `json:"update_time"`
    59  	VersionFormat                string                 `json:"version_format"`
    60  	VersionId                    string                 `json:"version_id"`
    61  	VersionName                  string                 `json:"version_name"`
    62  	WithColumnHeader             bool                   `json:"with_column_header"`
    63  }
    64  
    65  type ListDatasetVersions struct {
    66  	TotalNumber int              `json:"total_number"`
    67  	Versions    []DatasetVersion `json:"versions"`
    68  }
    69  
    70  type DatasetVersionPage struct {
    71  	pagination.OffsetPageBase
    72  }
    73  
    74  func (b DatasetVersionPage) IsEmpty() (bool, error) {
    75  	arr, err := ExtractDatasetVersions(b)
    76  	return len(arr) == 0, err
    77  }
    78  
    79  func ExtractDatasetVersions(r pagination.Page) ([]DatasetVersion, error) {
    80  	var s ListDatasetVersions
    81  	err := (r.(DatasetVersionPage)).ExtractInto(&s)
    82  	return s.Versions, err
    83  }