yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/huawei/client/modules/mod_snapshots.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 modules 16 17 import ( 18 "yunion.io/x/cloudmux/pkg/multicloud/huawei/client/manager" 19 "yunion.io/x/cloudmux/pkg/multicloud/huawei/client/responses" 20 ) 21 22 type SSnapshotManager struct { 23 SResourceManager 24 } 25 26 func NewSnapshotManager(cfg manager.IManagerConfig) *SSnapshotManager { 27 return &SSnapshotManager{SResourceManager: SResourceManager{ 28 SBaseManager: NewBaseManager(cfg), 29 ServiceName: ServiceNameEVS, 30 Region: cfg.GetRegionId(), 31 ProjectId: cfg.GetProjectId(), 32 version: "v2", 33 Keyword: "snapshot", 34 KeywordPlural: "snapshots", 35 36 ResourceKeyword: "snapshots", 37 }} 38 } 39 40 func (self *SSnapshotManager) List(querys map[string]string) (*responses.ListResult, error) { 41 return self.ListInContextWithSpec(nil, "detail", querys, self.KeywordPlural) 42 } 43 44 // https://support.huaweicloud.com/api-evs/zh-cn_topic_0051408629.html 45 // 回滚快照只能用这个manger。其他情况请不要使用 46 // 另外,香港-亚太还支持另外一个接口。https://support.huaweicloud.com/api-evs/zh-cn_topic_0142374138.html 47 func NewOsSnapshotManager(cfg manager.IManagerConfig) *SSnapshotManager { 48 return &SSnapshotManager{SResourceManager: SResourceManager{ 49 SBaseManager: NewBaseManager(cfg), 50 ServiceName: ServiceNameEVS, 51 Region: cfg.GetRegionId(), 52 ProjectId: cfg.GetProjectId(), 53 version: "v2", 54 Keyword: "snapshot", 55 KeywordPlural: "snapshots", 56 57 ResourceKeyword: "os-vendor-snapshots", 58 }} 59 }