Closed zliang-akamai closed 5 months ago
What does this PR do and why is this change necessary?
make ARGS="-run TestObjectStorageKeys_Regional" fixtures
make ARGS="-run TestObjectStorageBucket_Regional" fixtures
package main import ( "context" "fmt" "log" "net/http" "os" "github.com/linode/linodego" "golang.org/x/oauth2" ) func main() { apiKey, ok := os.LookupEnv("LINODE_TOKEN") if !ok { log.Fatal("Could not find LINODE_TOKEN, please assert it is set.") } tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey}) oauth2Client := &http.Client{ Transport: &oauth2.Transport{ Source: tokenSource, }, } linodeClient := linodego.NewClient(oauth2Client) linodeClient.SetDebug(true) bucket, err := linodeClient.CreateObjectStorageBucket( context.Background(), linodego.ObjectStorageBucketCreateOptions{ Label: "test-mc-bucket", Region: "us-east", }, ) fmt.Printf("%v", bucket) fmt.Printf("%v", err) key, err := linodeClient.CreateObjectStorageKey( context.Background(), linodego.ObjectStorageKeyCreateOptions{ Label: "test-key", BucketAccess: &[]linodego.ObjectStorageKeyBucketAccess{ { BucketName: bucket.Label, Permissions: "read_only", Region: "us-east", }, }, Regions: nil, }, ) fmt.Printf("%v", key) fmt.Printf("%v", err) linodeClient.DeleteObjectStorageBucket(context.Background(), "us-east", bucket.Label) linodeClient.DeleteObjectStorageKey(context.Background(), key.ID) }
📝 Description
What does this PR do and why is this change necessary?
✔️ How to Test