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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package appintegrationsservice_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/appintegrationsservice"
)
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 an application
// The following creates an application named My Application with access url https://example.com.
func ExampleAppIntegrationsService_CreateApplication_shared00() {
svc := appintegrationsservice.New(session.New())
input := &appintegrationsservice.CreateApplicationInput{
ApplicationSourceConfig: &appintegrationsservice.ApplicationSourceConfig{
ExternalUrlConfig: &appintegrationsservice.ExternalUrlConfig{
AccessUrl: aws.String("https://example.com"),
},
},
Description: aws.String("My first application."),
Name: aws.String("My Application"),
Namespace: aws.String("myapplication"),
}
result, err := svc.CreateApplication(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case appintegrationsservice.ErrCodeInternalServiceError:
fmt.Println(appintegrationsservice.ErrCodeInternalServiceError, aerr.Error())
case appintegrationsservice.ErrCodeResourceQuotaExceededException:
fmt.Println(appintegrationsservice.ErrCodeResourceQuotaExceededException, aerr.Error())
case appintegrationsservice.ErrCodeDuplicateResourceException:
fmt.Println(appintegrationsservice.ErrCodeDuplicateResourceException, aerr.Error())
case appintegrationsservice.ErrCodeThrottlingException:
fmt.Println(appintegrationsservice.ErrCodeThrottlingException, aerr.Error())
case appintegrationsservice.ErrCodeInvalidRequestException:
fmt.Println(appintegrationsservice.ErrCodeInvalidRequestException, aerr.Error())
case appintegrationsservice.ErrCodeAccessDeniedException:
fmt.Println(appintegrationsservice.ErrCodeAccessDeniedException, 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 get an application
// The following retrives an application.
func ExampleAppIntegrationsService_GetApplication_shared00() {
svc := appintegrationsservice.New(session.New())
input := &appintegrationsservice.GetApplicationInput{
Arn: aws.String("arn:aws:app-integrations:us-west-2:0123456789012:application/98542c53-e8ac-4570-9c85-c6552c8d9c5e"),
}
result, err := svc.GetApplication(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case appintegrationsservice.ErrCodeInternalServiceError:
fmt.Println(appintegrationsservice.ErrCodeInternalServiceError, aerr.Error())
case appintegrationsservice.ErrCodeThrottlingException:
fmt.Println(appintegrationsservice.ErrCodeThrottlingException, aerr.Error())
case appintegrationsservice.ErrCodeResourceNotFoundException:
fmt.Println(appintegrationsservice.ErrCodeResourceNotFoundException, aerr.Error())
case appintegrationsservice.ErrCodeInvalidRequestException:
fmt.Println(appintegrationsservice.ErrCodeInvalidRequestException, aerr.Error())
case appintegrationsservice.ErrCodeAccessDeniedException:
fmt.Println(appintegrationsservice.ErrCodeAccessDeniedException, 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 applications in the account
// The following lists application summary in the account.
func ExampleAppIntegrationsService_ListApplications_shared00() {
svc := appintegrationsservice.New(session.New())
input := &appintegrationsservice.ListApplicationsInput{
MaxResults: aws.Int64(1),
}
result, err := svc.ListApplications(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case appintegrationsservice.ErrCodeInternalServiceError:
fmt.Println(appintegrationsservice.ErrCodeInternalServiceError, aerr.Error())
case appintegrationsservice.ErrCodeThrottlingException:
fmt.Println(appintegrationsservice.ErrCodeThrottlingException, aerr.Error())
case appintegrationsservice.ErrCodeInvalidRequestException:
fmt.Println(appintegrationsservice.ErrCodeInvalidRequestException, aerr.Error())
case appintegrationsservice.ErrCodeAccessDeniedException:
fmt.Println(appintegrationsservice.ErrCodeAccessDeniedException, 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 update an application
// The following updates an existing application named with a new name.
func ExampleAppIntegrationsService_UpdateApplication_shared00() {
svc := appintegrationsservice.New(session.New())
input := &appintegrationsservice.UpdateApplicationInput{
Arn: aws.String("arn:aws:app-integrations:us-west-2:0123456789012:application/98542c53-e8ac-4570-9c85-c6552c8d9c5e"),
Name: aws.String("My New Application Name"),
}
result, err := svc.UpdateApplication(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case appintegrationsservice.ErrCodeInternalServiceError:
fmt.Println(appintegrationsservice.ErrCodeInternalServiceError, aerr.Error())
case appintegrationsservice.ErrCodeThrottlingException:
fmt.Println(appintegrationsservice.ErrCodeThrottlingException, aerr.Error())
case appintegrationsservice.ErrCodeResourceNotFoundException:
fmt.Println(appintegrationsservice.ErrCodeResourceNotFoundException, aerr.Error())
case appintegrationsservice.ErrCodeInvalidRequestException:
fmt.Println(appintegrationsservice.ErrCodeInvalidRequestException, aerr.Error())
case appintegrationsservice.ErrCodeAccessDeniedException:
fmt.Println(appintegrationsservice.ErrCodeAccessDeniedException, 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)
}
|