Documentation ¶
Index ¶
- Constants
- func IsGCEError(err error, reason string) bool
- func NewAltTokenSource(tokenURL, tokenBody string) oauth2.TokenSource
- type AltTokenSource
- type CloudDisk
- func (d *CloudDisk) GetKind() string
- func (d *CloudDisk) GetName() string
- func (d *CloudDisk) GetSelfLink() string
- func (d *CloudDisk) GetSizeGb() int64
- func (d *CloudDisk) GetSnapshotId() string
- func (d *CloudDisk) GetType() string
- func (d *CloudDisk) GetUsers() []string
- func (d *CloudDisk) GetZone() string
- func (d *CloudDisk) Type() CloudDiskType
- type CloudDiskType
- type CloudProvider
- func (cloud *CloudProvider) AttachDisk(ctx context.Context, volKey *meta.Key, ...) error
- func (cloud *CloudProvider) CreateSnapshot(ctx context.Context, volKey *meta.Key, snapshotName string) (*compute.Snapshot, error)
- func (cloud *CloudProvider) DeleteDisk(ctx context.Context, volKey *meta.Key) error
- func (cloud *CloudProvider) DeleteSnapshot(ctx context.Context, snapshotName string) error
- func (cloud *CloudProvider) DetachDisk(ctx context.Context, deviceName, instanceZone, instanceName string) error
- func (cloud *CloudProvider) GetDisk(ctx context.Context, key *meta.Key) (*CloudDisk, error)
- func (cloud *CloudProvider) GetDiskSourceURI(volKey *meta.Key) string
- func (cloud *CloudProvider) GetDiskTypeURI(volKey *meta.Key, diskType string) string
- func (cloud *CloudProvider) GetInstanceOrError(ctx context.Context, instanceZone, instanceName string) (*compute.Instance, error)
- func (cloud *CloudProvider) GetReplicaZoneURI(zone string) string
- func (cloud *CloudProvider) GetSnapshot(ctx context.Context, snapshotName string) (*compute.Snapshot, error)
- func (cloud *CloudProvider) InsertDisk(ctx context.Context, volKey *meta.Key, diskType string, capBytes int64, ...) error
- func (cloud *CloudProvider) ListSnapshots(ctx context.Context, filter string, maxEntries int64, pageToken string) ([]*compute.Snapshot, string, error)
- func (cloud *CloudProvider) ListZones(ctx context.Context, region string) ([]string, error)
- func (cloud *CloudProvider) RepairUnderspecifiedVolumeKey(ctx context.Context, volumeKey *meta.Key) (*meta.Key, error)
- func (cloud *CloudProvider) ValidateExistingDisk(ctx context.Context, resp *CloudDisk, diskType string, ...) error
- func (cloud *CloudProvider) WaitForAttach(ctx context.Context, volKey *meta.Key, instanceZone, instanceName string) error
- type ConfigFile
- type ConfigGlobal
- type FakeCloudProvider
- func (cloud *FakeCloudProvider) AttachDisk(ctx context.Context, volKey *meta.Key, ...) error
- func (cloud *FakeCloudProvider) CreateSnapshot(ctx context.Context, volKey *meta.Key, snapshotName string) (*compute.Snapshot, error)
- func (cloud *FakeCloudProvider) DeleteDisk(ctx context.Context, volKey *meta.Key) error
- func (cloud *FakeCloudProvider) DeleteSnapshot(ctx context.Context, snapshotName string) error
- func (cloud *FakeCloudProvider) DetachDisk(ctx context.Context, deviceName, instanceZone, instanceName string) error
- func (cloud *FakeCloudProvider) GetDisk(ctx context.Context, volKey *meta.Key) (*CloudDisk, error)
- func (cloud *FakeCloudProvider) GetDiskSourceURI(volKey *meta.Key) string
- func (cloud *FakeCloudProvider) GetDiskTypeURI(volKey *meta.Key, diskType string) string
- func (cloud *FakeCloudProvider) GetInstanceOrError(ctx context.Context, instanceZone, instanceName string) (*compute.Instance, error)
- func (cloud *FakeCloudProvider) GetReplicaZoneURI(zone string) string
- func (cloud *FakeCloudProvider) GetSnapshot(ctx context.Context, snapshotName string) (*compute.Snapshot, error)
- func (cloud *FakeCloudProvider) InsertDisk(ctx context.Context, volKey *meta.Key, diskType string, capBytes int64, ...) error
- func (cloud *FakeCloudProvider) InsertInstance(instance *compute.Instance, instanceZone, instanceName string)
- func (cloud *FakeCloudProvider) ListSnapshots(ctx context.Context, filter string, maxEntries int64, pageToken string) ([]*compute.Snapshot, string, error)
- func (cloud *FakeCloudProvider) ListZones(ctx context.Context, region string) ([]string, error)
- func (cloud *FakeCloudProvider) RepairUnderspecifiedVolumeKey(ctx context.Context, volumeKey *meta.Key) (*meta.Key, error)
- func (cloud *FakeCloudProvider) ValidateExistingDisk(ctx context.Context, resp *CloudDisk, diskType string, ...) error
- func (cloud *FakeCloudProvider) ValidateExistingSnapshot(resp *compute.Snapshot, volKey *meta.Key) error
- func (cloud *FakeCloudProvider) WaitForAttach(ctx context.Context, volKey *meta.Key, instanceZone, instanceName string) error
- type GCECompute
Constants ¶
View Source
const ( // Zonal key type. Zonal = "zonal" // Regional key type. Regional = "regional" // Global key type. Global = "global" )
View Source
const ( DiskSizeGb = 10 Timestamp = "2018-09-05T15:17:08.270-07:00" BasePath = "https://www.googleapis.com/compute/v1/projects/" )
View Source
const ( TokenURL = "https://accounts.google.com/o/oauth2/token" GCEComputeAPIEndpoint = "https://www.googleapis.com/compute/v1/" GCEComputeBetaAPIEndpoint = "https://www.googleapis.com/compute/beta/" )
Variables ¶
This section is empty.
Functions ¶
func IsGCEError ¶
isGCEError returns true if given error is a googleapi.Error with given reason (e.g. "resourceInUseByAnotherResource")
func NewAltTokenSource ¶ added in v0.5.0
func NewAltTokenSource(tokenURL, tokenBody string) oauth2.TokenSource
NewAltTokenSource constructs a new alternate token source for generating tokens.
Types ¶
type AltTokenSource ¶ added in v0.5.0
type AltTokenSource struct {
// contains filtered or unexported fields
}
AltTokenSource is the structure holding the data for the functionality needed to generates tokens
type CloudDisk ¶
type CloudDisk struct { ZonalDisk *compute.Disk RegionalDisk *computebeta.Disk }
func RegionalCloudDisk ¶
func RegionalCloudDisk(disk *computebeta.Disk) *CloudDisk
func ZonalCloudDisk ¶
func (*CloudDisk) GetSelfLink ¶
func (*CloudDisk) GetSnapshotId ¶ added in v0.3.0
func (*CloudDisk) Type ¶
func (d *CloudDisk) Type() CloudDiskType
type CloudDiskType ¶
type CloudDiskType string
type CloudProvider ¶
type CloudProvider struct {
// contains filtered or unexported fields
}
func CreateCloudProvider ¶
func CreateCloudProvider(vendorVersion string, configPath string) (*CloudProvider, error)
func (*CloudProvider) AttachDisk ¶
func (*CloudProvider) CreateSnapshot ¶
func (*CloudProvider) DeleteDisk ¶
func (*CloudProvider) DeleteSnapshot ¶
func (cloud *CloudProvider) DeleteSnapshot(ctx context.Context, snapshotName string) error
func (*CloudProvider) DetachDisk ¶
func (cloud *CloudProvider) DetachDisk(ctx context.Context, deviceName, instanceZone, instanceName string) error
func (*CloudProvider) GetDiskSourceURI ¶
func (cloud *CloudProvider) GetDiskSourceURI(volKey *meta.Key) string
func (*CloudProvider) GetDiskTypeURI ¶
func (cloud *CloudProvider) GetDiskTypeURI(volKey *meta.Key, diskType string) string
func (*CloudProvider) GetInstanceOrError ¶
func (*CloudProvider) GetReplicaZoneURI ¶
func (cloud *CloudProvider) GetReplicaZoneURI(zone string) string
func (*CloudProvider) GetSnapshot ¶
func (*CloudProvider) InsertDisk ¶
func (*CloudProvider) ListSnapshots ¶
func (*CloudProvider) RepairUnderspecifiedVolumeKey ¶
func (cloud *CloudProvider) RepairUnderspecifiedVolumeKey(ctx context.Context, volumeKey *meta.Key) (*meta.Key, error)
RepairUnderspecifiedVolumeKey will query the cloud provider and check each zone for the disk specified by the volume key and return a volume key with a correct zone
func (*CloudProvider) ValidateExistingDisk ¶
func (*CloudProvider) WaitForAttach ¶
type ConfigFile ¶ added in v0.5.0
type ConfigFile struct {
Global ConfigGlobal `gcfg:"global"`
}
type ConfigGlobal ¶ added in v0.5.0
type FakeCloudProvider ¶
type FakeCloudProvider struct {
// contains filtered or unexported fields
}
func FakeCreateCloudProvider ¶
func FakeCreateCloudProvider(project, zone string, cloudDisks []*CloudDisk) (*FakeCloudProvider, error)
func (*FakeCloudProvider) AttachDisk ¶
func (*FakeCloudProvider) CreateSnapshot ¶
func (*FakeCloudProvider) DeleteDisk ¶
func (*FakeCloudProvider) DeleteSnapshot ¶
func (cloud *FakeCloudProvider) DeleteSnapshot(ctx context.Context, snapshotName string) error
Snapshot Methods
func (*FakeCloudProvider) DetachDisk ¶
func (cloud *FakeCloudProvider) DetachDisk(ctx context.Context, deviceName, instanceZone, instanceName string) error
func (*FakeCloudProvider) GetDiskSourceURI ¶
func (cloud *FakeCloudProvider) GetDiskSourceURI(volKey *meta.Key) string
func (*FakeCloudProvider) GetDiskTypeURI ¶
func (cloud *FakeCloudProvider) GetDiskTypeURI(volKey *meta.Key, diskType string) string
func (*FakeCloudProvider) GetInstanceOrError ¶
func (*FakeCloudProvider) GetReplicaZoneURI ¶
func (cloud *FakeCloudProvider) GetReplicaZoneURI(zone string) string
Regional Disk Methods
func (*FakeCloudProvider) GetSnapshot ¶
func (cloud *FakeCloudProvider) GetSnapshot(ctx context.Context, snapshotName string) (*compute.Snapshot, error)
Snapshot Methods
func (*FakeCloudProvider) InsertDisk ¶
func (*FakeCloudProvider) InsertInstance ¶
func (cloud *FakeCloudProvider) InsertInstance(instance *compute.Instance, instanceZone, instanceName string)
Instance Methods
func (*FakeCloudProvider) ListSnapshots ¶
func (*FakeCloudProvider) RepairUnderspecifiedVolumeKey ¶
func (*FakeCloudProvider) ValidateExistingDisk ¶
func (*FakeCloudProvider) ValidateExistingSnapshot ¶
func (*FakeCloudProvider) WaitForAttach ¶
type GCECompute ¶
type GCECompute interface { // Disk Methods GetDisk(ctx context.Context, volumeKey *meta.Key) (*CloudDisk, error) RepairUnderspecifiedVolumeKey(ctx context.Context, volumeKey *meta.Key) (*meta.Key, error) ValidateExistingDisk(ctx context.Context, disk *CloudDisk, diskType string, reqBytes, limBytes int64) error InsertDisk(ctx context.Context, volKey *meta.Key, diskType string, capBytes int64, capacityRange *csi.CapacityRange, replicaZones []string, snapshotId, diskEncryptionKmsKey string) error DeleteDisk(ctx context.Context, volumeKey *meta.Key) error AttachDisk(ctx context.Context, volKey *meta.Key, readWrite, diskType, instanceZone, instanceName string) error DetachDisk(ctx context.Context, deviceName string, instanceZone, instanceName string) error GetDiskSourceURI(volKey *meta.Key) string GetDiskTypeURI(volKey *meta.Key, diskType string) string WaitForAttach(ctx context.Context, volKey *meta.Key, instanceZone, instanceName string) error // Regional Disk Methods GetReplicaZoneURI(zone string) string // Instance Methods GetInstanceOrError(ctx context.Context, instanceZone, instanceName string) (*compute.Instance, error) // Zone Methods ListZones(ctx context.Context, region string) ([]string, error) ListSnapshots(ctx context.Context, filter string, maxEntries int64, pageToken string) ([]*compute.Snapshot, string, error) GetSnapshot(ctx context.Context, snapshotName string) (*compute.Snapshot, error) CreateSnapshot(ctx context.Context, volKey *meta.Key, snapshotName string) (*compute.Snapshot, error) DeleteSnapshot(ctx context.Context, snapshotName string) error }
Click to show internal directories.
Click to hide internal directories.