| 1 | package kms |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | |
| 6 | "github.com/denverdino/aliyungo/common" |
| 7 | ) |
| 8 | |
| 9 | var ( |
| 10 | TestAccessKeyId = os.Getenv("AccessKeyId") |
| 11 | TestAccessKeySecret = os.Getenv("AccessKeySecret") |
| 12 | TestSecurityToken = os.Getenv("SecurityToken") |
| 13 | TestRegionID = common.Region(os.Getenv("RegionId")) |
| 14 | TestKeyId = os.Getenv("KeyId") |
| 15 | |
| 16 | encryptionContext = map[string]string{ |
| 17 | "Key1": "Value1", |
| 18 | "Key2": "Value2", |
| 19 | } |
| 20 | |
| 21 | debugClient = NetTestLocationClientForDebug() |
| 22 | ) |
| 23 | |
| 24 | var testClient *Client |
| 25 | |
| 26 | func NewTestClient() *Client { |
| 27 | if testClient == nil { |
| 28 | testClient = NewClient(TestAccessKeyId, TestAccessKeySecret) |
| 29 | } |
| 30 | return testClient |
| 31 | } |
| 32 | |
| 33 | var testDebugClient *Client |
| 34 | |
| 35 | func NewTestClientForDebug() *Client { |
| 36 | if testDebugClient == nil { |
| 37 | testDebugClient = NewClient(TestAccessKeyId, TestAccessKeySecret) |
| 38 | testDebugClient.SetDebug(true) |
| 39 | } |
| 40 | return testDebugClient |
| 41 | } |
| 42 | |
| 43 | var testLocationClient *Client |
| 44 | |
| 45 | func NetTestLocationClientForDebug() *Client { |
| 46 | if testLocationClient == nil { |
| 47 | testLocationClient = NewClientWithRegion(TestAccessKeyId, TestAccessKeySecret, TestRegionID) |
| 48 | testLocationClient.SetDebug(true) |
| 49 | } |
| 50 | |
| 51 | return testLocationClient |
| 52 | } |