yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/bingocloud/storagecache.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 bingocloud 16 17 import ( 18 "context" 19 "fmt" 20 21 "yunion.io/x/jsonutils" 22 23 "yunion.io/x/cloudmux/pkg/cloudprovider" 24 "yunion.io/x/onecloud/pkg/mcclient" 25 "yunion.io/x/cloudmux/pkg/multicloud" 26 ) 27 28 type SStoragecache struct { 29 multicloud.SResourceBase 30 multicloud.STagBase 31 32 region *SRegion 33 storageId string 34 storageName string 35 } 36 37 func (self *SStoragecache) GetId() string { 38 return fmt.Sprintf("%s-%s", self.region.GetGlobalId(), self.storageId) 39 } 40 41 func (self *SStoragecache) GetGlobalId() string { 42 return self.GetId() 43 } 44 45 func (self *SStoragecache) GetName() string { 46 return self.storageName 47 } 48 49 func (self *SStoragecache) GetICustomizedCloudImages() ([]cloudprovider.ICloudImage, error) { 50 return nil, cloudprovider.ErrNotImplemented 51 } 52 53 func (self *SStoragecache) GetPath() string { 54 return "" 55 } 56 57 func (self *SStoragecache) GetStatus() string { 58 return "available" 59 } 60 61 func (self *SStoragecache) CreateIImage(snapshotId, imageName, osType, imageDesc string) (cloudprovider.ICloudImage, error) { 62 return nil, cloudprovider.ErrNotImplemented 63 } 64 65 func (self *SStoragecache) DownloadImage(userCred mcclient.TokenCredential, imageId string, extId string, path string) (jsonutils.JSONObject, error) { 66 return nil, cloudprovider.ErrNotImplemented 67 } 68 69 func (self *SStoragecache) UploadImage(ctx context.Context, userCred mcclient.TokenCredential, image *cloudprovider.SImageCreateOption, callback func(float32)) (string, error) { 70 return "", cloudprovider.ErrNotImplemented 71 }