yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/ucloud/project.go (about)

     1  // Copyright 2019 Yunion
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package ucloud
    16  
    17  import (
    18  	"yunion.io/x/cloudmux/pkg/multicloud"
    19  )
    20  
    21  // https://docs.ucloud.cn/api/summary/get_project_list
    22  type SProject struct {
    23  	multicloud.SProjectBase
    24  	UcloudTags
    25  	ProjectID     string `json:"ProjectId"`
    26  	ProjectName   string `json:"ProjectName"`
    27  	ParentID      string `json:"ParentId"`
    28  	ParentName    string `json:"ParentName"`
    29  	CreateTime    int64  `json:"CreateTime"`
    30  	IsDefault     bool   `json:"IsDefault"`
    31  	MemberCount   int64  `json:"MemberCount"`
    32  	ResourceCount int64  `json:"ResourceCount"`
    33  }
    34  
    35  func (self *SProject) GetId() string {
    36  	return self.ProjectID
    37  }
    38  
    39  func (self *SProject) GetName() string {
    40  	return self.ProjectName
    41  }
    42  
    43  func (self *SProject) GetGlobalId() string {
    44  	return self.GetId()
    45  }
    46  
    47  func (self *SProject) GetStatus() string {
    48  	return ""
    49  }
    50  
    51  func (self *SProject) Refresh() error {
    52  	return nil
    53  }
    54  
    55  func (self *SProject) IsEmulated() bool {
    56  	return false
    57  }
    58  
    59  func (self *SUcloudClient) FetchProjects() ([]SProject, error) {
    60  	params := NewUcloudParams()
    61  	projects := make([]SProject, 0)
    62  	err := self.DoListAll("GetProjectList", params, &projects)
    63  	return projects, err
    64  }