Documentation
¶
Index ¶
- Constants
- func All(sku *SKU, conditions []FilterFn) bool
- func LocationFilter(location string) func(*SKU) bool
- func NameFilter(name string) func(*SKU) bool
- func ResourceTypeFilter(resourceType string) func(*SKU) bool
- func UnsafeLocationFilter(location string) func(*SKU) bool
- type Cache
- func (c *Cache) Equal(other *Cache) bool
- func (c *Cache) Get(ctx context.Context, name, resourceType, location string) (SKU, error)
- func (c *Cache) GetAvailabilityZones(ctx context.Context, filters ...FilterFn) []string
- func (c *Cache) GetVirtualMachineAvailabilityZones(ctx context.Context) []string
- func (c *Cache) GetVirtualMachineAvailabilityZonesForSize(ctx context.Context, size string) []string
- func (c *Cache) GetVirtualMachines(ctx context.Context) []SKU
- func (c *Cache) List(ctx context.Context, filters ...FilterFn) []SKU
- type Config
- type ErrCapabilityNotFound
- type ErrCapabilityValueNil
- type ErrCapabilityValueParse
- type ErrClientNil
- type ErrClientNotNil
- type ErrMultipleSKUsMatch
- type ErrSKUNotFound
- type FilterFn
- type MapFn
- type NewCacheFunc
- type Option
- type ResourceClient
- type ResourceProviderClient
- type SKU
- func (s *SKU) AvailabilityZones(location string) map[string]bool
- func (s *SKU) Equal(other *SKU) bool
- func (s *SKU) GPU() (int64, error)
- func (s *SKU) GetCPUArchitectureType() (string, error)
- func (s *SKU) GetCapabilityFloatQuantity(name string) (float64, error)
- func (s *SKU) GetCapabilityIntegerQuantity(name string) (int64, error)
- func (s *SKU) GetCapabilityString(name string) (string, error)
- func (s *SKU) GetFamilyName() string
- func (s *SKU) GetLocation() (string, error)
- func (s *SKU) GetName() string
- func (s *SKU) GetResourceType() string
- func (s *SKU) GetSize() string
- func (s *SKU) GetVMSize() (*VMSizeType, error)
- func (s *SKU) HasCapability(name string) bool
- func (s *SKU) HasCapabilityInZone(name, zone string) bool
- func (s *SKU) HasCapabilityWithMinCapacity(name string, value int64) (bool, error)
- func (s *SKU) HasCapabilityWithSeparator(name, value string) bool
- func (s *SKU) HasLocation(location string) bool
- func (s *SKU) HasLocationRestriction(location string) bool
- func (s *SKU) HasZonalCapability(name string) bool
- func (s *SKU) IsAcceleratedNetworkingSupported() bool
- func (s *SKU) IsAvailable(location string) bool
- func (s *SKU) IsConfidentialComputingTypeSNP() (bool, error)
- func (s *SKU) IsEncryptionAtHostSupported() bool
- func (s *SKU) IsEphemeralOSDiskSupported() bool
- func (s *SKU) IsHyperVGen1Supported() bool
- func (s *SKU) IsHyperVGen2Supported() bool
- func (s *SKU) IsPremiumIO() bool
- func (s *SKU) IsResourceType(t string) bool
- func (s *SKU) IsRestricted(location string) bool
- func (s *SKU) IsTrustedLaunchEnabled() (bool, error)
- func (s *SKU) IsUltraSSDAvailable() booldeprecated
- func (s *SKU) IsUltraSSDAvailableInAvailabilityZone(zone string) bool
- func (s *SKU) IsUltraSSDAvailableWithoutAvailabilityZone() bool
- func (s *SKU) MaxCachedDiskBytes() (int64, error)
- func (s *SKU) MaxResourceVolumeMB() (int64, error)
- func (s *SKU) Memory() (float64, error)
- func (s *SKU) VCPU() (int64, error)
- type Supported
- type VMSizeType
Constants ¶
const ( // VirtualMachines is the . VirtualMachines = "virtualMachines" // Disks is a convenience constant to filter resource SKUs to only include disks. Disks = "disks" )
const ( // EphemeralOSDisk identifies the capability for ephemeral os support. EphemeralOSDisk = "EphemeralOSDiskSupported" // AcceleratedNetworking identifies the capability for accelerated networking support. AcceleratedNetworking = "AcceleratedNetworkingEnabled" // VCPUs identifies the capability for the number of vCPUS. VCPUs = "vCPUs" // GPUs identifies the capability for the number of GPUS. GPUs = "GPUs" // MemoryGB identifies the capability for memory capacity. MemoryGB = "MemoryGB" // HyperVGenerations identifies the hyper-v generations this vm sku supports. HyperVGenerations = "HyperVGenerations" // EncryptionAtHost identifies the capability for accelerated networking support. EncryptionAtHost = "EncryptionAtHostSupported" // UltraSSDAvailable identifies the capability for ultra ssd // enablement. UltraSSDAvailable = "UltraSSDAvailable" // CachedDiskBytes identifies the maximum size of the cache disk for // a vm. CachedDiskBytes = "CachedDiskBytes" // MaxResourceVolumeMB identifies the maximum size of the temporary // disk for a vm. MaxResourceVolumeMB = "MaxResourceVolumeMB" // CapabilityPremiumIO identifies the capability for PremiumIO. CapabilityPremiumIO = "PremiumIO" // CapabilityCpuArchitectureType identifies the type of CPU architecture (x64,Arm64). CapabilityCPUArchitectureType = "CpuArchitectureType" // CapabilityTrustedLaunchDisabled identifes whether TrustedLaunch is disabled. CapabilityTrustedLaunchDisabled = "TrustedLaunchDisabled" // CapabilityConfidentialComputingType identifies the type of ConfidentialComputing. CapabilityConfidentialComputingType = "ConfidentialComputingType" // ConfidentialComputingTypeSNP denoted the "SNP" ConfidentialComputing. ConfidentialComputingTypeSNP = "SNP" )
const ( // HyperVGeneration1 identifies a sku which supports HyperV // Generation 1. HyperVGeneration1 = "V1" // HyperVGeneration2 identifies a sku which supports HyperV // Generation 2. HyperVGeneration2 = "V2" )
Variables ¶
This section is empty.
Functions ¶
func LocationFilter ¶ added in v0.0.4
LocationFilter matches against a SKU listing the given location
func NameFilter ¶
NameFilter produces a filter function for the name of a resource sku.
func ResourceTypeFilter ¶
ResourceTypeFilter produces a filter function for any resource type.
func UnsafeLocationFilter ¶ added in v0.0.5
UnsafeLocationFilter produces a filter function for the location of a resource sku. This function dangerously ignores all SKUS without a properly specified location. Use this only if you know what you are doing.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache stores a list of known skus, possibly fetched with a provided client
func NewCache ¶
NewCache instantiates a cache of resource sku data with a ResourceClient client, optionally with additional filtering by location. The accepted client interface matches the real Azure clients (it returns a paginated iterator).
func NewStaticCache ¶
NewStaticCache initializes a cache with data and no ability to refresh. Used for testing.
func (*Cache) GetAvailabilityZones ¶
GetAvailabilityZones returns the list of all availability zones in a given azure location.
func (*Cache) GetVirtualMachineAvailabilityZones ¶
GetVirtualMachineAvailabilityZones returns all virtual machine zones available in a given location.
func (*Cache) GetVirtualMachineAvailabilityZonesForSize ¶
func (c *Cache) GetVirtualMachineAvailabilityZonesForSize(ctx context.Context, size string) []string
GetVirtualMachineAvailabilityZonesForSize returns all virtual machine zones available in a given location.
func (*Cache) GetVirtualMachines ¶
GetVirtualMachines returns the list of all virtual machines *SKUs in a given azure location.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains configuration options for a cache.
type ErrCapabilityNotFound ¶
type ErrCapabilityNotFound struct {
// contains filtered or unexported fields
}
ErrCapabilityNotFound will be returned when a capability could not be found, even without a value.
func (*ErrCapabilityNotFound) Error ¶
func (e *ErrCapabilityNotFound) Error() string
type ErrCapabilityValueNil ¶
type ErrCapabilityValueNil struct {
// contains filtered or unexported fields
}
ErrCapabilityValueNil will be returned when a capability was found by name but the value was nil.
func (*ErrCapabilityValueNil) Error ¶
func (e *ErrCapabilityValueNil) Error() string
type ErrCapabilityValueParse ¶
type ErrCapabilityValueParse struct {
// contains filtered or unexported fields
}
ErrCapabilityValueParse will be returned when a capability was found by name but there was error parsing the capability.
func (*ErrCapabilityValueParse) Error ¶
func (e *ErrCapabilityValueParse) Error() string
type ErrClientNil ¶
type ErrClientNil struct { }
ErrClientNil will be returned when a user attempts to create a cache without a client and use it.
func (*ErrClientNil) Error ¶
func (e *ErrClientNil) Error() string
type ErrClientNotNil ¶
type ErrClientNotNil struct { }
ErrClientNotNil will be returned when a user attempts to set two clients on the same cache.
func (*ErrClientNotNil) Error ¶
func (e *ErrClientNotNil) Error() string
type ErrMultipleSKUsMatch ¶ added in v0.0.7
ErrMultipleSKUsMatch will be returned when multiple skus match a fully qualified triple of resource type, location and name. This should usually not happen.
func (*ErrMultipleSKUsMatch) Error ¶ added in v0.0.7
func (e *ErrMultipleSKUsMatch) Error() string
type ErrSKUNotFound ¶ added in v0.0.7
ErrSKUNotFound will be returned when no skus match a fully qualified triple of resource type, location and name. The SKU may not exist.
func (*ErrSKUNotFound) Error ¶ added in v0.0.7
func (e *ErrSKUNotFound) Error() string
type NewCacheFunc ¶
NewCacheFunc describes the live cache instantiation signature. Used for testing.
type Option ¶
Option describes functional options to customize the listing behavior of the cache.
func WithClient ¶
func WithClient(client client) Option
WithClient is a functional option to use a cache backed by a client meeting the skewer signature.
func WithExtendedLocations ¶ added in v0.0.16
func WithExtendedLocations() Option
WithExtendedLocations is a functional option to include extended locations
func WithLocation ¶
WithLocation is a functional option to filter skus by location
func WithResourceClient ¶
func WithResourceClient(client ResourceClient) Option
WithResourceClient is a functional option to use a cache backed by a ResourceClient.
func WithResourceProviderClient ¶
func WithResourceProviderClient(client ResourceProviderClient) Option
WithResourceProviderClient is a functional option to use a cache backed by a ResourceProviderClient.
type ResourceClient ¶
type ResourceClient interface {
ListComplete(ctx context.Context, filter, includeExtendedLocations string) (compute.ResourceSkusResultIterator, error)
}
ResourceClient is the required Azure client interface used to populate skewer's data.
type ResourceProviderClient ¶
type ResourceProviderClient interface {
List(ctx context.Context, filter, includeExtendedLocations string) (compute.ResourceSkusResultPage, error)
}
ResourceProviderClient is a convenience interface for uses cases specific to Azure resource providers.
type SKU ¶
type SKU compute.ResourceSku
SKU wraps an Azure compute SKU with richer functionality
func Filter ¶
Filter returns a new slice containing all values in the slice that satisfy all filterFn predicates.
func Map ¶
Map returns a new slice containing the results of applying the mapFn to each value in the original slice.
func Wrap ¶
func Wrap(in []compute.ResourceSku) []SKU
Wrap takes an array of compute resource skus and wraps them into an array of our richer type.
func (*SKU) AvailabilityZones ¶
AvailabilityZones returns the list of Availability Zones which have this resource SKU available and unrestricted.
func (*SKU) GetCPUArchitectureType ¶ added in v0.0.18
GetCPUArchitectureType returns cpu arch for the VM size. It errors if value is nil or not found.
func (*SKU) GetCapabilityFloatQuantity ¶
GetCapabilityFloatQuantity retrieves and parses the value of a floating point numeric capability with the provided name. It errors if the capability is not found, the value was nil, or the value could not be parsed as an integer.
func (*SKU) GetCapabilityIntegerQuantity ¶
GetCapabilityIntegerQuantity retrieves and parses the value of an integer numeric capability with the provided name. It errors if the capability is not found, the value was nil, or the value could not be parsed as an integer.
func (*SKU) GetCapabilityString ¶ added in v0.0.18
GetCapabilityString retrieves string capability with the provided name. It errors if the capability is not found or the value was nil
func (*SKU) GetFamilyName ¶ added in v0.0.14
GetFamilyName returns the family name of this resource sku. It normalizes pointers to the empty string for comparison purposes. For example, "standardDSv2Family" for a virtual machine.
func (*SKU) GetLocation ¶
GetLocation returns the location for a given SKU.
func (*SKU) GetName ¶
GetName returns the name of this resource sku. It normalizes pointers to the empty string for comparison purposes. For example, "Standard_D8s_v3" for a virtual machine.
func (*SKU) GetResourceType ¶
GetResourceType returns the name of this resource sku. It normalizes pointers to the empty string for comparison purposes. For example, "virtualMachines" for a virtual machine.
func (*SKU) GetSize ¶ added in v0.0.18
GetSize returns the size of this resource sku. It normalizes pointers to the empty string for comparison purposes. For example, "M416ms_v2" for a virtual machine.
func (*SKU) GetVMSize ¶ added in v0.0.18
func (s *SKU) GetVMSize() (*VMSizeType, error)
func (*SKU) HasCapability ¶
HasCapability return true for a capability which can be either supported or not. Examples include "EphemeralOSDiskSupported", "EncryptionAtHostSupported", "AcceleratedNetworkingEnabled", and "RdmaEnabled"
func (*SKU) HasCapabilityInZone ¶ added in v0.0.13
HasCapabilityInZone return true if the specified capability name is supported in the specified zone.
func (*SKU) HasCapabilityWithMinCapacity ¶ added in v0.0.8
HasCapabilityWithMinCapacity returns true when the SKU has a capability with the requested name, and the value is greater than or equal to the desired value. "MaxResourceVolumeMB", "OSVhdSizeMB", "vCPUs", "MemoryGB","MaxDataDiskCount", "CombinedTempDiskAndCachedIOPS", "CombinedTempDiskAndCachedReadBytesPerSecond", "CombinedTempDiskAndCachedWriteBytesPerSecond", "UncachedDiskIOPS", and "UncachedDiskBytesPerSecond"
func (*SKU) HasCapabilityWithSeparator ¶
HasCapabilityWithSeparator return true for a capability which may be exposed as a comma-separated list. We check that the list contains the desired substring. An example is "HyperVGenerations" which may be "V1,V2"
func (*SKU) HasLocation ¶ added in v0.0.7
HasLocation returns true if the given sku exposes this region for deployment.
func (*SKU) HasLocationRestriction ¶ added in v0.0.7
HasLocationRestriction returns true if the location is restricted for this sku.
func (*SKU) HasZonalCapability ¶
HasZonalCapability return true for a capability which can be either supported or not. Examples include "UltraSSDAvailable". This function only checks that zone details suggest support: it will return true for a whole location even when only one zone supports the feature. Currently, the only real scenario that appears to use zoneDetails is UltraSSDAvailable which always lists all regions as available. For per zone capability check, use "HasCapabilityInZone"
func (*SKU) IsAcceleratedNetworkingSupported ¶ added in v0.0.9
IsAcceleratedNetworkingSupported returns true when the VM size supports accelerated networking.
func (*SKU) IsAvailable ¶
IsAvailable returns true when the requested location matches one on the sku, and there are no total restrictions on the location.
func (*SKU) IsConfidentialComputingTypeSNP ¶ added in v0.0.18
IsConfidentialComputingTypeSNP return true if ConfidentialComputingType is SNP for this sku.
func (*SKU) IsEncryptionAtHostSupported ¶
IsEncryptionAtHostSupported returns true when Encryption at Host is supported for the VM size.
func (*SKU) IsEphemeralOSDiskSupported ¶
IsEphemeralOSDiskSupported returns true when the VM size supports ephemeral OS.
func (*SKU) IsHyperVGen1Supported ¶ added in v0.0.18
IsHyperVGen1Supported returns true when the VM size supports accelerated networking.
func (*SKU) IsHyperVGen2Supported ¶ added in v0.0.9
IsHyperVGen2Supported returns true when the VM size supports accelerated networking.
func (*SKU) IsPremiumIO ¶ added in v0.0.18
IsPremiumIO returns true when the VM size supports PremiumIO.
func (*SKU) IsResourceType ¶
IsResourceType returns true when the wrapped SKU has the provided value as its resource type. This may be used to filter using values such as "virtualMachines", "disks", "availabilitySets", "snapshots", and "hostGroups/hosts".
func (*SKU) IsRestricted ¶
IsRestricted returns true when a location restriction exists for this SKU.
func (*SKU) IsTrustedLaunchEnabled ¶ added in v0.0.18
Official documentation for Trusted Launch states: The response will be similar to the following form: IsTrustedLaunchEnabled True in the output indicates that the Generation 2 VM size does not support Trusted launch. If it's a Generation 2 VM size and TrustedLaunchDisabled is not part of the output, it implies that Trusted launch is supported for that VM size.
func (*SKU) IsUltraSSDAvailable
deprecated
func (*SKU) IsUltraSSDAvailableInAvailabilityZone ¶ added in v0.0.13
IsUltraSSDAvailableInAvailabilityZone returns true when a VM size has ultra SSD enabled in the given availability zone
func (*SKU) IsUltraSSDAvailableWithoutAvailabilityZone ¶ added in v0.0.13
IsUltraSSDAvailableWithoutAvailabilityZone returns true when a VM size has ultra SSD enabled in the region
func (*SKU) MaxCachedDiskBytes ¶
MaxCachedDiskBytes returns the number of bytes available for the cache if it exists on this VM size.
func (*SKU) MaxResourceVolumeMB ¶ added in v0.0.10
MaxResourceVolumeMB returns the number of bytes available for the cache if it exists on this VM size.
type Supported ¶
type Supported string
Supported models an enum of possible boolean values for resource support in the Azure API.
const ( // CapabilitySupported is an enum value for the string "True" returned when a SKU supports a binary capability. CapabilitySupported Supported = "True" // CapabilityUnsupported is an enum value for the string "False" returned when a SKU does not support a binary capability. CapabilityUnsupported Supported = "False" )