forked from juju/juju
/
instancetypes.go
73 lines (67 loc) · 2.89 KB
/
instancetypes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2021 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package testing
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
)
// DescribeInstanceTypeOfferings implements ec2.Client.
func (*Server) DescribeInstanceTypeOfferings(_ context.Context, _ *ec2.DescribeInstanceTypeOfferingsInput, _ ...func(*ec2.Options)) (*ec2.DescribeInstanceTypeOfferingsOutput, error) {
result := &ec2.DescribeInstanceTypeOfferingsOutput{}
for _, instTypeName := range []types.InstanceType{"t3a.micro", "t3a.medium", "t2.medium", "m1.small"} {
for _, zoneName := range []string{"test-available", "test-impaired", "test-unavailable", "test-available2"} {
result.InstanceTypeOfferings = append(result.InstanceTypeOfferings, types.InstanceTypeOffering{
InstanceType: instTypeName,
Location: aws.String(zoneName),
LocationType: "availability-zone",
})
}
}
return result, nil
}
// DescribeInstanceTypes implements ec2.Client.
func (*Server) DescribeInstanceTypes(_ context.Context, _ *ec2.DescribeInstanceTypesInput, _ ...func(*ec2.Options)) (*ec2.DescribeInstanceTypesOutput, error) {
return &ec2.DescribeInstanceTypesOutput{
InstanceTypes: []types.InstanceTypeInfo{{
InstanceType: "t3a.micro",
VCpuInfo: &types.VCpuInfo{DefaultVCpus: aws.Int32(2)},
MemoryInfo: &types.MemoryInfo{SizeInMiB: aws.Int64(1024)},
ProcessorInfo: &types.ProcessorInfo{
SupportedArchitectures: []types.ArchitectureType{"x86_64"},
SustainedClockSpeedInGhz: aws.Float64(2.5),
},
CurrentGeneration: aws.Bool(true),
}, {
InstanceType: "t3a.medium",
VCpuInfo: &types.VCpuInfo{DefaultVCpus: aws.Int32(2)},
MemoryInfo: &types.MemoryInfo{SizeInMiB: aws.Int64(4096)},
ProcessorInfo: &types.ProcessorInfo{
SupportedArchitectures: []types.ArchitectureType{"x86_64"},
SustainedClockSpeedInGhz: aws.Float64(2.5),
},
CurrentGeneration: aws.Bool(true),
}, {
InstanceType: "t2.medium",
VCpuInfo: &types.VCpuInfo{DefaultVCpus: aws.Int32(2)},
MemoryInfo: &types.MemoryInfo{SizeInMiB: aws.Int64(1024)},
ProcessorInfo: &types.ProcessorInfo{
SupportedArchitectures: []types.ArchitectureType{"x86_64"},
SustainedClockSpeedInGhz: aws.Float64(2.5),
},
CurrentGeneration: aws.Bool(true),
}, {
InstanceType: "m1.small",
MemoryInfo: &types.MemoryInfo{SizeInMiB: aws.Int64(1024)},
ProcessorInfo: &types.ProcessorInfo{SupportedArchitectures: []types.ArchitectureType{"x86_64"}},
CurrentGeneration: aws.Bool(true),
}},
}, nil
}
// DescribeSpotPriceHistory implements ec2.Client.
func (*Server) DescribeSpotPriceHistory(_ context.Context, _ *ec2.DescribeSpotPriceHistoryInput, _ ...func(*ec2.Options)) (*ec2.DescribeSpotPriceHistoryOutput, error) {
return &ec2.DescribeSpotPriceHistoryOutput{
SpotPriceHistory: nil,
}, nil
}