mirror of
https://github.com/Luzifer/cloudkeys-go.git
synced 2024-11-15 01:12:44 +00:00
9c6e3c89a5
* fix js scoping issue * add external libraries (they were offline too often) * new compiled scripts and css * new fixes in the binary * vendor update * change js source * remove needless variable * removed more needless variables
185 lines
5.3 KiB
Go
185 lines
5.3 KiB
Go
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
|
|
|
package eks_test
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
|
"github.com/aws/aws-sdk-go/aws/session"
|
|
"github.com/aws/aws-sdk-go/service/eks"
|
|
)
|
|
|
|
var _ time.Duration
|
|
var _ strings.Reader
|
|
var _ aws.Config
|
|
|
|
func parseTime(layout, value string) *time.Time {
|
|
t, err := time.Parse(layout, value)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return &t
|
|
}
|
|
|
|
// To create a new cluster
|
|
//
|
|
// The following example creates an Amazon EKS cluster called prod.
|
|
func ExampleEKS_CreateCluster_shared00() {
|
|
svc := eks.New(session.New())
|
|
input := &eks.CreateClusterInput{
|
|
ClientRequestToken: aws.String("1d2129a1-3d38-460a-9756-e5b91fddb951"),
|
|
Name: aws.String("prod"),
|
|
ResourcesVpcConfig: &eks.VpcConfigRequest{
|
|
SecurityGroupIds: []*string{
|
|
aws.String("sg-6979fe18"),
|
|
},
|
|
SubnetIds: []*string{
|
|
aws.String("subnet-6782e71e"),
|
|
aws.String("subnet-e7e761ac"),
|
|
},
|
|
},
|
|
RoleArn: aws.String("arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI"),
|
|
Version: aws.String("1.10"),
|
|
}
|
|
|
|
result, err := svc.CreateCluster(input)
|
|
if err != nil {
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
switch aerr.Code() {
|
|
case eks.ErrCodeResourceInUseException:
|
|
fmt.Println(eks.ErrCodeResourceInUseException, aerr.Error())
|
|
case eks.ErrCodeResourceLimitExceededException:
|
|
fmt.Println(eks.ErrCodeResourceLimitExceededException, aerr.Error())
|
|
case eks.ErrCodeInvalidParameterException:
|
|
fmt.Println(eks.ErrCodeInvalidParameterException, aerr.Error())
|
|
case eks.ErrCodeClientException:
|
|
fmt.Println(eks.ErrCodeClientException, aerr.Error())
|
|
case eks.ErrCodeServerException:
|
|
fmt.Println(eks.ErrCodeServerException, aerr.Error())
|
|
case eks.ErrCodeServiceUnavailableException:
|
|
fmt.Println(eks.ErrCodeServiceUnavailableException, aerr.Error())
|
|
case eks.ErrCodeUnsupportedAvailabilityZoneException:
|
|
fmt.Println(eks.ErrCodeUnsupportedAvailabilityZoneException, aerr.Error())
|
|
default:
|
|
fmt.Println(aerr.Error())
|
|
}
|
|
} else {
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
// Message from an error.
|
|
fmt.Println(err.Error())
|
|
}
|
|
return
|
|
}
|
|
|
|
fmt.Println(result)
|
|
}
|
|
|
|
// To delete a cluster
|
|
//
|
|
// This example command deletes a cluster named `devel` in your default region.
|
|
func ExampleEKS_DeleteCluster_shared00() {
|
|
svc := eks.New(session.New())
|
|
input := &eks.DeleteClusterInput{
|
|
Name: aws.String("devel"),
|
|
}
|
|
|
|
result, err := svc.DeleteCluster(input)
|
|
if err != nil {
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
switch aerr.Code() {
|
|
case eks.ErrCodeResourceInUseException:
|
|
fmt.Println(eks.ErrCodeResourceInUseException, aerr.Error())
|
|
case eks.ErrCodeResourceNotFoundException:
|
|
fmt.Println(eks.ErrCodeResourceNotFoundException, aerr.Error())
|
|
case eks.ErrCodeClientException:
|
|
fmt.Println(eks.ErrCodeClientException, aerr.Error())
|
|
case eks.ErrCodeServerException:
|
|
fmt.Println(eks.ErrCodeServerException, aerr.Error())
|
|
case eks.ErrCodeServiceUnavailableException:
|
|
fmt.Println(eks.ErrCodeServiceUnavailableException, aerr.Error())
|
|
default:
|
|
fmt.Println(aerr.Error())
|
|
}
|
|
} else {
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
// Message from an error.
|
|
fmt.Println(err.Error())
|
|
}
|
|
return
|
|
}
|
|
|
|
fmt.Println(result)
|
|
}
|
|
|
|
// To describe a cluster
|
|
//
|
|
// This example command provides a description of the specified cluster in your default
|
|
// region.
|
|
func ExampleEKS_DescribeCluster_shared00() {
|
|
svc := eks.New(session.New())
|
|
input := &eks.DescribeClusterInput{
|
|
Name: aws.String("devel"),
|
|
}
|
|
|
|
result, err := svc.DescribeCluster(input)
|
|
if err != nil {
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
switch aerr.Code() {
|
|
case eks.ErrCodeResourceNotFoundException:
|
|
fmt.Println(eks.ErrCodeResourceNotFoundException, aerr.Error())
|
|
case eks.ErrCodeClientException:
|
|
fmt.Println(eks.ErrCodeClientException, aerr.Error())
|
|
case eks.ErrCodeServerException:
|
|
fmt.Println(eks.ErrCodeServerException, aerr.Error())
|
|
case eks.ErrCodeServiceUnavailableException:
|
|
fmt.Println(eks.ErrCodeServiceUnavailableException, aerr.Error())
|
|
default:
|
|
fmt.Println(aerr.Error())
|
|
}
|
|
} else {
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
// Message from an error.
|
|
fmt.Println(err.Error())
|
|
}
|
|
return
|
|
}
|
|
|
|
fmt.Println(result)
|
|
}
|
|
|
|
// To list your available clusters
|
|
//
|
|
// This example command lists all of your available clusters in your default region.
|
|
func ExampleEKS_ListClusters_shared00() {
|
|
svc := eks.New(session.New())
|
|
input := &eks.ListClustersInput{}
|
|
|
|
result, err := svc.ListClusters(input)
|
|
if err != nil {
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
switch aerr.Code() {
|
|
case eks.ErrCodeInvalidParameterException:
|
|
fmt.Println(eks.ErrCodeInvalidParameterException, aerr.Error())
|
|
case eks.ErrCodeClientException:
|
|
fmt.Println(eks.ErrCodeClientException, aerr.Error())
|
|
case eks.ErrCodeServerException:
|
|
fmt.Println(eks.ErrCodeServerException, aerr.Error())
|
|
case eks.ErrCodeServiceUnavailableException:
|
|
fmt.Println(eks.ErrCodeServiceUnavailableException, aerr.Error())
|
|
default:
|
|
fmt.Println(aerr.Error())
|
|
}
|
|
} else {
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
// Message from an error.
|
|
fmt.Println(err.Error())
|
|
}
|
|
return
|
|
}
|
|
|
|
fmt.Println(result)
|
|
}
|