update vendor/ dir to latest w/o heroku, moby

had to lock a lot of things in place
This commit is contained in:
Reed Allman
2017-08-03 02:38:15 -07:00
parent 780791da1c
commit 30f3c45dbc
5637 changed files with 191713 additions and 1133103 deletions

View File

@@ -1,52 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package acmiface provides an interface for the AWS Certificate Manager.
package acmiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/acm"
)
// ACMAPI is the interface type for acm.ACM.
type ACMAPI interface {
AddTagsToCertificateRequest(*acm.AddTagsToCertificateInput) (*request.Request, *acm.AddTagsToCertificateOutput)
AddTagsToCertificate(*acm.AddTagsToCertificateInput) (*acm.AddTagsToCertificateOutput, error)
DeleteCertificateRequest(*acm.DeleteCertificateInput) (*request.Request, *acm.DeleteCertificateOutput)
DeleteCertificate(*acm.DeleteCertificateInput) (*acm.DeleteCertificateOutput, error)
DescribeCertificateRequest(*acm.DescribeCertificateInput) (*request.Request, *acm.DescribeCertificateOutput)
DescribeCertificate(*acm.DescribeCertificateInput) (*acm.DescribeCertificateOutput, error)
GetCertificateRequest(*acm.GetCertificateInput) (*request.Request, *acm.GetCertificateOutput)
GetCertificate(*acm.GetCertificateInput) (*acm.GetCertificateOutput, error)
ListCertificatesRequest(*acm.ListCertificatesInput) (*request.Request, *acm.ListCertificatesOutput)
ListCertificates(*acm.ListCertificatesInput) (*acm.ListCertificatesOutput, error)
ListCertificatesPages(*acm.ListCertificatesInput, func(*acm.ListCertificatesOutput, bool) bool) error
ListTagsForCertificateRequest(*acm.ListTagsForCertificateInput) (*request.Request, *acm.ListTagsForCertificateOutput)
ListTagsForCertificate(*acm.ListTagsForCertificateInput) (*acm.ListTagsForCertificateOutput, error)
RemoveTagsFromCertificateRequest(*acm.RemoveTagsFromCertificateInput) (*request.Request, *acm.RemoveTagsFromCertificateOutput)
RemoveTagsFromCertificate(*acm.RemoveTagsFromCertificateInput) (*acm.RemoveTagsFromCertificateOutput, error)
RequestCertificateRequest(*acm.RequestCertificateInput) (*request.Request, *acm.RequestCertificateOutput)
RequestCertificate(*acm.RequestCertificateInput) (*acm.RequestCertificateOutput, error)
ResendValidationEmailRequest(*acm.ResendValidationEmailInput) (*request.Request, *acm.ResendValidationEmailOutput)
ResendValidationEmail(*acm.ResendValidationEmailInput) (*acm.ResendValidationEmailOutput, error)
}
var _ ACMAPI = (*acm.ACM)(nil)

File diff suppressed because it is too large Load Diff

View File

@@ -1,220 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package acm_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/acm"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleACM_AddTagsToCertificate() {
svc := acm.New(session.New())
params := &acm.AddTagsToCertificateInput{
CertificateArn: aws.String("Arn"), // Required
Tags: []*acm.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.AddTagsToCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_DeleteCertificate() {
svc := acm.New(session.New())
params := &acm.DeleteCertificateInput{
CertificateArn: aws.String("Arn"), // Required
}
resp, err := svc.DeleteCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_DescribeCertificate() {
svc := acm.New(session.New())
params := &acm.DescribeCertificateInput{
CertificateArn: aws.String("Arn"), // Required
}
resp, err := svc.DescribeCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_GetCertificate() {
svc := acm.New(session.New())
params := &acm.GetCertificateInput{
CertificateArn: aws.String("Arn"), // Required
}
resp, err := svc.GetCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_ListCertificates() {
svc := acm.New(session.New())
params := &acm.ListCertificatesInput{
CertificateStatuses: []*string{
aws.String("CertificateStatus"), // Required
// More values...
},
MaxItems: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListCertificates(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_ListTagsForCertificate() {
svc := acm.New(session.New())
params := &acm.ListTagsForCertificateInput{
CertificateArn: aws.String("Arn"), // Required
}
resp, err := svc.ListTagsForCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_RemoveTagsFromCertificate() {
svc := acm.New(session.New())
params := &acm.RemoveTagsFromCertificateInput{
CertificateArn: aws.String("Arn"), // Required
Tags: []*acm.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.RemoveTagsFromCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_RequestCertificate() {
svc := acm.New(session.New())
params := &acm.RequestCertificateInput{
DomainName: aws.String("DomainNameString"), // Required
DomainValidationOptions: []*acm.DomainValidationOption{
{ // Required
DomainName: aws.String("DomainNameString"), // Required
ValidationDomain: aws.String("DomainNameString"), // Required
},
// More values...
},
IdempotencyToken: aws.String("IdempotencyToken"),
SubjectAlternativeNames: []*string{
aws.String("DomainNameString"), // Required
// More values...
},
}
resp, err := svc.RequestCertificate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleACM_ResendValidationEmail() {
svc := acm.New(session.New())
params := &acm.ResendValidationEmailInput{
CertificateArn: aws.String("Arn"), // Required
Domain: aws.String("DomainNameString"), // Required
ValidationDomain: aws.String("DomainNameString"), // Required
}
resp, err := svc.ResendValidationEmail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,95 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package acm
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Welcome to the AWS Certificate Manager (ACM) Command Reference. This guide
// provides descriptions, syntax, and usage examples for each ACM command. You
// can use AWS Certificate Manager to request ACM Certificates for your AWS-based
// websites and applications. For general information about using ACM and for
// more information about using the console, see the AWS Certificate Manager
// User Guide (http://docs.aws.amazon.com/acm/latest/userguide/acm-overview.html).
// For more information about using the ACM API, see the AWS Certificate Manager
// API Reference (http://docs.aws.amazon.com/acm/latest/APIReference/Welcome.html).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type ACM struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "acm"
// New creates a new instance of the ACM client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a ACM client from just a session.
// svc := acm.New(mySession)
//
// // Create a ACM client with additional configuration
// svc := acm.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *ACM {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ACM {
svc := &ACM{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-12-08",
JSONVersion: "1.1",
TargetPrefix: "CertificateManager",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a ACM operation and runs any
// custom request initialization.
func (c *ACM) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,338 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package apigatewayiface provides an interface for the Amazon API Gateway.
package apigatewayiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/apigateway"
)
// APIGatewayAPI is the interface type for apigateway.APIGateway.
type APIGatewayAPI interface {
CreateApiKeyRequest(*apigateway.CreateApiKeyInput) (*request.Request, *apigateway.ApiKey)
CreateApiKey(*apigateway.CreateApiKeyInput) (*apigateway.ApiKey, error)
CreateAuthorizerRequest(*apigateway.CreateAuthorizerInput) (*request.Request, *apigateway.Authorizer)
CreateAuthorizer(*apigateway.CreateAuthorizerInput) (*apigateway.Authorizer, error)
CreateBasePathMappingRequest(*apigateway.CreateBasePathMappingInput) (*request.Request, *apigateway.BasePathMapping)
CreateBasePathMapping(*apigateway.CreateBasePathMappingInput) (*apigateway.BasePathMapping, error)
CreateDeploymentRequest(*apigateway.CreateDeploymentInput) (*request.Request, *apigateway.Deployment)
CreateDeployment(*apigateway.CreateDeploymentInput) (*apigateway.Deployment, error)
CreateDomainNameRequest(*apigateway.CreateDomainNameInput) (*request.Request, *apigateway.DomainName)
CreateDomainName(*apigateway.CreateDomainNameInput) (*apigateway.DomainName, error)
CreateModelRequest(*apigateway.CreateModelInput) (*request.Request, *apigateway.Model)
CreateModel(*apigateway.CreateModelInput) (*apigateway.Model, error)
CreateResourceRequest(*apigateway.CreateResourceInput) (*request.Request, *apigateway.Resource)
CreateResource(*apigateway.CreateResourceInput) (*apigateway.Resource, error)
CreateRestApiRequest(*apigateway.CreateRestApiInput) (*request.Request, *apigateway.RestApi)
CreateRestApi(*apigateway.CreateRestApiInput) (*apigateway.RestApi, error)
CreateStageRequest(*apigateway.CreateStageInput) (*request.Request, *apigateway.Stage)
CreateStage(*apigateway.CreateStageInput) (*apigateway.Stage, error)
DeleteApiKeyRequest(*apigateway.DeleteApiKeyInput) (*request.Request, *apigateway.DeleteApiKeyOutput)
DeleteApiKey(*apigateway.DeleteApiKeyInput) (*apigateway.DeleteApiKeyOutput, error)
DeleteAuthorizerRequest(*apigateway.DeleteAuthorizerInput) (*request.Request, *apigateway.DeleteAuthorizerOutput)
DeleteAuthorizer(*apigateway.DeleteAuthorizerInput) (*apigateway.DeleteAuthorizerOutput, error)
DeleteBasePathMappingRequest(*apigateway.DeleteBasePathMappingInput) (*request.Request, *apigateway.DeleteBasePathMappingOutput)
DeleteBasePathMapping(*apigateway.DeleteBasePathMappingInput) (*apigateway.DeleteBasePathMappingOutput, error)
DeleteClientCertificateRequest(*apigateway.DeleteClientCertificateInput) (*request.Request, *apigateway.DeleteClientCertificateOutput)
DeleteClientCertificate(*apigateway.DeleteClientCertificateInput) (*apigateway.DeleteClientCertificateOutput, error)
DeleteDeploymentRequest(*apigateway.DeleteDeploymentInput) (*request.Request, *apigateway.DeleteDeploymentOutput)
DeleteDeployment(*apigateway.DeleteDeploymentInput) (*apigateway.DeleteDeploymentOutput, error)
DeleteDomainNameRequest(*apigateway.DeleteDomainNameInput) (*request.Request, *apigateway.DeleteDomainNameOutput)
DeleteDomainName(*apigateway.DeleteDomainNameInput) (*apigateway.DeleteDomainNameOutput, error)
DeleteIntegrationRequest(*apigateway.DeleteIntegrationInput) (*request.Request, *apigateway.DeleteIntegrationOutput)
DeleteIntegration(*apigateway.DeleteIntegrationInput) (*apigateway.DeleteIntegrationOutput, error)
DeleteIntegrationResponseRequest(*apigateway.DeleteIntegrationResponseInput) (*request.Request, *apigateway.DeleteIntegrationResponseOutput)
DeleteIntegrationResponse(*apigateway.DeleteIntegrationResponseInput) (*apigateway.DeleteIntegrationResponseOutput, error)
DeleteMethodRequest(*apigateway.DeleteMethodInput) (*request.Request, *apigateway.DeleteMethodOutput)
DeleteMethod(*apigateway.DeleteMethodInput) (*apigateway.DeleteMethodOutput, error)
DeleteMethodResponseRequest(*apigateway.DeleteMethodResponseInput) (*request.Request, *apigateway.DeleteMethodResponseOutput)
DeleteMethodResponse(*apigateway.DeleteMethodResponseInput) (*apigateway.DeleteMethodResponseOutput, error)
DeleteModelRequest(*apigateway.DeleteModelInput) (*request.Request, *apigateway.DeleteModelOutput)
DeleteModel(*apigateway.DeleteModelInput) (*apigateway.DeleteModelOutput, error)
DeleteResourceRequest(*apigateway.DeleteResourceInput) (*request.Request, *apigateway.DeleteResourceOutput)
DeleteResource(*apigateway.DeleteResourceInput) (*apigateway.DeleteResourceOutput, error)
DeleteRestApiRequest(*apigateway.DeleteRestApiInput) (*request.Request, *apigateway.DeleteRestApiOutput)
DeleteRestApi(*apigateway.DeleteRestApiInput) (*apigateway.DeleteRestApiOutput, error)
DeleteStageRequest(*apigateway.DeleteStageInput) (*request.Request, *apigateway.DeleteStageOutput)
DeleteStage(*apigateway.DeleteStageInput) (*apigateway.DeleteStageOutput, error)
FlushStageAuthorizersCacheRequest(*apigateway.FlushStageAuthorizersCacheInput) (*request.Request, *apigateway.FlushStageAuthorizersCacheOutput)
FlushStageAuthorizersCache(*apigateway.FlushStageAuthorizersCacheInput) (*apigateway.FlushStageAuthorizersCacheOutput, error)
FlushStageCacheRequest(*apigateway.FlushStageCacheInput) (*request.Request, *apigateway.FlushStageCacheOutput)
FlushStageCache(*apigateway.FlushStageCacheInput) (*apigateway.FlushStageCacheOutput, error)
GenerateClientCertificateRequest(*apigateway.GenerateClientCertificateInput) (*request.Request, *apigateway.ClientCertificate)
GenerateClientCertificate(*apigateway.GenerateClientCertificateInput) (*apigateway.ClientCertificate, error)
GetAccountRequest(*apigateway.GetAccountInput) (*request.Request, *apigateway.Account)
GetAccount(*apigateway.GetAccountInput) (*apigateway.Account, error)
GetApiKeyRequest(*apigateway.GetApiKeyInput) (*request.Request, *apigateway.ApiKey)
GetApiKey(*apigateway.GetApiKeyInput) (*apigateway.ApiKey, error)
GetApiKeysRequest(*apigateway.GetApiKeysInput) (*request.Request, *apigateway.GetApiKeysOutput)
GetApiKeys(*apigateway.GetApiKeysInput) (*apigateway.GetApiKeysOutput, error)
GetApiKeysPages(*apigateway.GetApiKeysInput, func(*apigateway.GetApiKeysOutput, bool) bool) error
GetAuthorizerRequest(*apigateway.GetAuthorizerInput) (*request.Request, *apigateway.Authorizer)
GetAuthorizer(*apigateway.GetAuthorizerInput) (*apigateway.Authorizer, error)
GetAuthorizersRequest(*apigateway.GetAuthorizersInput) (*request.Request, *apigateway.GetAuthorizersOutput)
GetAuthorizers(*apigateway.GetAuthorizersInput) (*apigateway.GetAuthorizersOutput, error)
GetBasePathMappingRequest(*apigateway.GetBasePathMappingInput) (*request.Request, *apigateway.BasePathMapping)
GetBasePathMapping(*apigateway.GetBasePathMappingInput) (*apigateway.BasePathMapping, error)
GetBasePathMappingsRequest(*apigateway.GetBasePathMappingsInput) (*request.Request, *apigateway.GetBasePathMappingsOutput)
GetBasePathMappings(*apigateway.GetBasePathMappingsInput) (*apigateway.GetBasePathMappingsOutput, error)
GetBasePathMappingsPages(*apigateway.GetBasePathMappingsInput, func(*apigateway.GetBasePathMappingsOutput, bool) bool) error
GetClientCertificateRequest(*apigateway.GetClientCertificateInput) (*request.Request, *apigateway.ClientCertificate)
GetClientCertificate(*apigateway.GetClientCertificateInput) (*apigateway.ClientCertificate, error)
GetClientCertificatesRequest(*apigateway.GetClientCertificatesInput) (*request.Request, *apigateway.GetClientCertificatesOutput)
GetClientCertificates(*apigateway.GetClientCertificatesInput) (*apigateway.GetClientCertificatesOutput, error)
GetClientCertificatesPages(*apigateway.GetClientCertificatesInput, func(*apigateway.GetClientCertificatesOutput, bool) bool) error
GetDeploymentRequest(*apigateway.GetDeploymentInput) (*request.Request, *apigateway.Deployment)
GetDeployment(*apigateway.GetDeploymentInput) (*apigateway.Deployment, error)
GetDeploymentsRequest(*apigateway.GetDeploymentsInput) (*request.Request, *apigateway.GetDeploymentsOutput)
GetDeployments(*apigateway.GetDeploymentsInput) (*apigateway.GetDeploymentsOutput, error)
GetDeploymentsPages(*apigateway.GetDeploymentsInput, func(*apigateway.GetDeploymentsOutput, bool) bool) error
GetDomainNameRequest(*apigateway.GetDomainNameInput) (*request.Request, *apigateway.DomainName)
GetDomainName(*apigateway.GetDomainNameInput) (*apigateway.DomainName, error)
GetDomainNamesRequest(*apigateway.GetDomainNamesInput) (*request.Request, *apigateway.GetDomainNamesOutput)
GetDomainNames(*apigateway.GetDomainNamesInput) (*apigateway.GetDomainNamesOutput, error)
GetDomainNamesPages(*apigateway.GetDomainNamesInput, func(*apigateway.GetDomainNamesOutput, bool) bool) error
GetExportRequest(*apigateway.GetExportInput) (*request.Request, *apigateway.GetExportOutput)
GetExport(*apigateway.GetExportInput) (*apigateway.GetExportOutput, error)
GetIntegrationRequest(*apigateway.GetIntegrationInput) (*request.Request, *apigateway.Integration)
GetIntegration(*apigateway.GetIntegrationInput) (*apigateway.Integration, error)
GetIntegrationResponseRequest(*apigateway.GetIntegrationResponseInput) (*request.Request, *apigateway.IntegrationResponse)
GetIntegrationResponse(*apigateway.GetIntegrationResponseInput) (*apigateway.IntegrationResponse, error)
GetMethodRequest(*apigateway.GetMethodInput) (*request.Request, *apigateway.Method)
GetMethod(*apigateway.GetMethodInput) (*apigateway.Method, error)
GetMethodResponseRequest(*apigateway.GetMethodResponseInput) (*request.Request, *apigateway.MethodResponse)
GetMethodResponse(*apigateway.GetMethodResponseInput) (*apigateway.MethodResponse, error)
GetModelRequest(*apigateway.GetModelInput) (*request.Request, *apigateway.Model)
GetModel(*apigateway.GetModelInput) (*apigateway.Model, error)
GetModelTemplateRequest(*apigateway.GetModelTemplateInput) (*request.Request, *apigateway.GetModelTemplateOutput)
GetModelTemplate(*apigateway.GetModelTemplateInput) (*apigateway.GetModelTemplateOutput, error)
GetModelsRequest(*apigateway.GetModelsInput) (*request.Request, *apigateway.GetModelsOutput)
GetModels(*apigateway.GetModelsInput) (*apigateway.GetModelsOutput, error)
GetModelsPages(*apigateway.GetModelsInput, func(*apigateway.GetModelsOutput, bool) bool) error
GetResourceRequest(*apigateway.GetResourceInput) (*request.Request, *apigateway.Resource)
GetResource(*apigateway.GetResourceInput) (*apigateway.Resource, error)
GetResourcesRequest(*apigateway.GetResourcesInput) (*request.Request, *apigateway.GetResourcesOutput)
GetResources(*apigateway.GetResourcesInput) (*apigateway.GetResourcesOutput, error)
GetResourcesPages(*apigateway.GetResourcesInput, func(*apigateway.GetResourcesOutput, bool) bool) error
GetRestApiRequest(*apigateway.GetRestApiInput) (*request.Request, *apigateway.RestApi)
GetRestApi(*apigateway.GetRestApiInput) (*apigateway.RestApi, error)
GetRestApisRequest(*apigateway.GetRestApisInput) (*request.Request, *apigateway.GetRestApisOutput)
GetRestApis(*apigateway.GetRestApisInput) (*apigateway.GetRestApisOutput, error)
GetRestApisPages(*apigateway.GetRestApisInput, func(*apigateway.GetRestApisOutput, bool) bool) error
GetSdkRequest(*apigateway.GetSdkInput) (*request.Request, *apigateway.GetSdkOutput)
GetSdk(*apigateway.GetSdkInput) (*apigateway.GetSdkOutput, error)
GetStageRequest(*apigateway.GetStageInput) (*request.Request, *apigateway.Stage)
GetStage(*apigateway.GetStageInput) (*apigateway.Stage, error)
GetStagesRequest(*apigateway.GetStagesInput) (*request.Request, *apigateway.GetStagesOutput)
GetStages(*apigateway.GetStagesInput) (*apigateway.GetStagesOutput, error)
ImportRestApiRequest(*apigateway.ImportRestApiInput) (*request.Request, *apigateway.RestApi)
ImportRestApi(*apigateway.ImportRestApiInput) (*apigateway.RestApi, error)
PutIntegrationRequest(*apigateway.PutIntegrationInput) (*request.Request, *apigateway.Integration)
PutIntegration(*apigateway.PutIntegrationInput) (*apigateway.Integration, error)
PutIntegrationResponseRequest(*apigateway.PutIntegrationResponseInput) (*request.Request, *apigateway.IntegrationResponse)
PutIntegrationResponse(*apigateway.PutIntegrationResponseInput) (*apigateway.IntegrationResponse, error)
PutMethodRequest(*apigateway.PutMethodInput) (*request.Request, *apigateway.Method)
PutMethod(*apigateway.PutMethodInput) (*apigateway.Method, error)
PutMethodResponseRequest(*apigateway.PutMethodResponseInput) (*request.Request, *apigateway.MethodResponse)
PutMethodResponse(*apigateway.PutMethodResponseInput) (*apigateway.MethodResponse, error)
PutRestApiRequest(*apigateway.PutRestApiInput) (*request.Request, *apigateway.RestApi)
PutRestApi(*apigateway.PutRestApiInput) (*apigateway.RestApi, error)
TestInvokeAuthorizerRequest(*apigateway.TestInvokeAuthorizerInput) (*request.Request, *apigateway.TestInvokeAuthorizerOutput)
TestInvokeAuthorizer(*apigateway.TestInvokeAuthorizerInput) (*apigateway.TestInvokeAuthorizerOutput, error)
TestInvokeMethodRequest(*apigateway.TestInvokeMethodInput) (*request.Request, *apigateway.TestInvokeMethodOutput)
TestInvokeMethod(*apigateway.TestInvokeMethodInput) (*apigateway.TestInvokeMethodOutput, error)
UpdateAccountRequest(*apigateway.UpdateAccountInput) (*request.Request, *apigateway.Account)
UpdateAccount(*apigateway.UpdateAccountInput) (*apigateway.Account, error)
UpdateApiKeyRequest(*apigateway.UpdateApiKeyInput) (*request.Request, *apigateway.ApiKey)
UpdateApiKey(*apigateway.UpdateApiKeyInput) (*apigateway.ApiKey, error)
UpdateAuthorizerRequest(*apigateway.UpdateAuthorizerInput) (*request.Request, *apigateway.Authorizer)
UpdateAuthorizer(*apigateway.UpdateAuthorizerInput) (*apigateway.Authorizer, error)
UpdateBasePathMappingRequest(*apigateway.UpdateBasePathMappingInput) (*request.Request, *apigateway.BasePathMapping)
UpdateBasePathMapping(*apigateway.UpdateBasePathMappingInput) (*apigateway.BasePathMapping, error)
UpdateClientCertificateRequest(*apigateway.UpdateClientCertificateInput) (*request.Request, *apigateway.ClientCertificate)
UpdateClientCertificate(*apigateway.UpdateClientCertificateInput) (*apigateway.ClientCertificate, error)
UpdateDeploymentRequest(*apigateway.UpdateDeploymentInput) (*request.Request, *apigateway.Deployment)
UpdateDeployment(*apigateway.UpdateDeploymentInput) (*apigateway.Deployment, error)
UpdateDomainNameRequest(*apigateway.UpdateDomainNameInput) (*request.Request, *apigateway.DomainName)
UpdateDomainName(*apigateway.UpdateDomainNameInput) (*apigateway.DomainName, error)
UpdateIntegrationRequest(*apigateway.UpdateIntegrationInput) (*request.Request, *apigateway.Integration)
UpdateIntegration(*apigateway.UpdateIntegrationInput) (*apigateway.Integration, error)
UpdateIntegrationResponseRequest(*apigateway.UpdateIntegrationResponseInput) (*request.Request, *apigateway.IntegrationResponse)
UpdateIntegrationResponse(*apigateway.UpdateIntegrationResponseInput) (*apigateway.IntegrationResponse, error)
UpdateMethodRequest(*apigateway.UpdateMethodInput) (*request.Request, *apigateway.Method)
UpdateMethod(*apigateway.UpdateMethodInput) (*apigateway.Method, error)
UpdateMethodResponseRequest(*apigateway.UpdateMethodResponseInput) (*request.Request, *apigateway.MethodResponse)
UpdateMethodResponse(*apigateway.UpdateMethodResponseInput) (*apigateway.MethodResponse, error)
UpdateModelRequest(*apigateway.UpdateModelInput) (*request.Request, *apigateway.Model)
UpdateModel(*apigateway.UpdateModelInput) (*apigateway.Model, error)
UpdateResourceRequest(*apigateway.UpdateResourceInput) (*request.Request, *apigateway.Resource)
UpdateResource(*apigateway.UpdateResourceInput) (*apigateway.Resource, error)
UpdateRestApiRequest(*apigateway.UpdateRestApiInput) (*request.Request, *apigateway.RestApi)
UpdateRestApi(*apigateway.UpdateRestApiInput) (*apigateway.RestApi, error)
UpdateStageRequest(*apigateway.UpdateStageInput) (*request.Request, *apigateway.Stage)
UpdateStage(*apigateway.UpdateStageInput) (*apigateway.Stage, error)
}
var _ APIGatewayAPI = (*apigateway.APIGateway)(nil)

View File

@@ -1,14 +0,0 @@
package apigateway
import (
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/request"
)
func init() {
initClient = func(c *client.Client) {
c.Handlers.Build.PushBack(func(r *request.Request) {
r.HTTPRequest.Header.Add("Accept", "application/json")
})
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,90 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package apigateway
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// Amazon API Gateway helps developers deliver robust, secure and scalable mobile
// and web application backends. Amazon API Gateway allows developers to securely
// connect mobile and web applications to APIs that run on AWS Lambda, Amazon
// EC2, or other publicly addressable web services that are hosted outside of
// AWS.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type APIGateway struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "apigateway"
// New creates a new instance of the APIGateway client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a APIGateway client from just a session.
// svc := apigateway.New(mySession)
//
// // Create a APIGateway client with additional configuration
// svc := apigateway.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *APIGateway {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *APIGateway {
svc := &APIGateway{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-07-09",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a APIGateway operation and runs any
// custom request initialization.
func (c *APIGateway) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,48 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package applicationautoscalingiface provides an interface for the Application Auto Scaling.
package applicationautoscalingiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/applicationautoscaling"
)
// ApplicationAutoScalingAPI is the interface type for applicationautoscaling.ApplicationAutoScaling.
type ApplicationAutoScalingAPI interface {
DeleteScalingPolicyRequest(*applicationautoscaling.DeleteScalingPolicyInput) (*request.Request, *applicationautoscaling.DeleteScalingPolicyOutput)
DeleteScalingPolicy(*applicationautoscaling.DeleteScalingPolicyInput) (*applicationautoscaling.DeleteScalingPolicyOutput, error)
DeregisterScalableTargetRequest(*applicationautoscaling.DeregisterScalableTargetInput) (*request.Request, *applicationautoscaling.DeregisterScalableTargetOutput)
DeregisterScalableTarget(*applicationautoscaling.DeregisterScalableTargetInput) (*applicationautoscaling.DeregisterScalableTargetOutput, error)
DescribeScalableTargetsRequest(*applicationautoscaling.DescribeScalableTargetsInput) (*request.Request, *applicationautoscaling.DescribeScalableTargetsOutput)
DescribeScalableTargets(*applicationautoscaling.DescribeScalableTargetsInput) (*applicationautoscaling.DescribeScalableTargetsOutput, error)
DescribeScalableTargetsPages(*applicationautoscaling.DescribeScalableTargetsInput, func(*applicationautoscaling.DescribeScalableTargetsOutput, bool) bool) error
DescribeScalingActivitiesRequest(*applicationautoscaling.DescribeScalingActivitiesInput) (*request.Request, *applicationautoscaling.DescribeScalingActivitiesOutput)
DescribeScalingActivities(*applicationautoscaling.DescribeScalingActivitiesInput) (*applicationautoscaling.DescribeScalingActivitiesOutput, error)
DescribeScalingActivitiesPages(*applicationautoscaling.DescribeScalingActivitiesInput, func(*applicationautoscaling.DescribeScalingActivitiesOutput, bool) bool) error
DescribeScalingPoliciesRequest(*applicationautoscaling.DescribeScalingPoliciesInput) (*request.Request, *applicationautoscaling.DescribeScalingPoliciesOutput)
DescribeScalingPolicies(*applicationautoscaling.DescribeScalingPoliciesInput) (*applicationautoscaling.DescribeScalingPoliciesOutput, error)
DescribeScalingPoliciesPages(*applicationautoscaling.DescribeScalingPoliciesInput, func(*applicationautoscaling.DescribeScalingPoliciesOutput, bool) bool) error
PutScalingPolicyRequest(*applicationautoscaling.PutScalingPolicyInput) (*request.Request, *applicationautoscaling.PutScalingPolicyOutput)
PutScalingPolicy(*applicationautoscaling.PutScalingPolicyInput) (*applicationautoscaling.PutScalingPolicyOutput, error)
RegisterScalableTargetRequest(*applicationautoscaling.RegisterScalableTargetInput) (*request.Request, *applicationautoscaling.RegisterScalableTargetOutput)
RegisterScalableTarget(*applicationautoscaling.RegisterScalableTargetInput) (*applicationautoscaling.RegisterScalableTargetOutput, error)
}
var _ ApplicationAutoScalingAPI = (*applicationautoscaling.ApplicationAutoScaling)(nil)

View File

@@ -1,196 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package applicationautoscaling_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/applicationautoscaling"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleApplicationAutoScaling_DeleteScalingPolicy() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.DeleteScalingPolicyInput{
PolicyName: aws.String("ResourceIdMaxLen1600"), // Required
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
}
resp, err := svc.DeleteScalingPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationAutoScaling_DeregisterScalableTarget() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.DeregisterScalableTargetInput{
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
}
resp, err := svc.DeregisterScalableTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationAutoScaling_DescribeScalableTargets() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.DescribeScalableTargetsInput{
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("XmlString"),
ResourceIds: []*string{
aws.String("ResourceIdMaxLen1600"), // Required
// More values...
},
ScalableDimension: aws.String("ScalableDimension"),
}
resp, err := svc.DescribeScalableTargets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationAutoScaling_DescribeScalingActivities() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.DescribeScalingActivitiesInput{
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("XmlString"),
ResourceId: aws.String("ResourceIdMaxLen1600"),
ScalableDimension: aws.String("ScalableDimension"),
}
resp, err := svc.DescribeScalingActivities(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationAutoScaling_DescribeScalingPolicies() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.DescribeScalingPoliciesInput{
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("XmlString"),
PolicyNames: []*string{
aws.String("ResourceIdMaxLen1600"), // Required
// More values...
},
ResourceId: aws.String("ResourceIdMaxLen1600"),
ScalableDimension: aws.String("ScalableDimension"),
}
resp, err := svc.DescribeScalingPolicies(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationAutoScaling_PutScalingPolicy() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.PutScalingPolicyInput{
PolicyName: aws.String("PolicyName"), // Required
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
PolicyType: aws.String("PolicyType"),
StepScalingPolicyConfiguration: &applicationautoscaling.StepScalingPolicyConfiguration{
AdjustmentType: aws.String("AdjustmentType"),
Cooldown: aws.Int64(1),
MetricAggregationType: aws.String("MetricAggregationType"),
MinAdjustmentMagnitude: aws.Int64(1),
StepAdjustments: []*applicationautoscaling.StepAdjustment{
{ // Required
ScalingAdjustment: aws.Int64(1), // Required
MetricIntervalLowerBound: aws.Float64(1.0),
MetricIntervalUpperBound: aws.Float64(1.0),
},
// More values...
},
},
}
resp, err := svc.PutScalingPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationAutoScaling_RegisterScalableTarget() {
svc := applicationautoscaling.New(session.New())
params := &applicationautoscaling.RegisterScalableTargetInput{
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxCapacity: aws.Int64(1),
MinCapacity: aws.Int64(1),
RoleARN: aws.String("ResourceIdMaxLen1600"),
}
resp, err := svc.RegisterScalableTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,112 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package applicationautoscaling
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Application Auto Scaling is a general purpose Auto Scaling service for supported
// elastic AWS resources. With Application Auto Scaling, you can automatically
// scale your AWS resources, with an experience similar to that of Auto Scaling.
//
// At this time, Application Auto Scaling only supports scaling Amazon ECS
// services.
//
// For example, you can use Application Auto Scaling to accomplish the following
// tasks:
//
// Define scaling policies for automatically adjusting your applications
// resources
//
// Scale your resources in response to CloudWatch alarms
//
// View history of your scaling events
//
// Application Auto Scaling is available in the following regions:
//
// us-east-1
//
// us-west-2
//
// eu-west-1
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type ApplicationAutoScaling struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "autoscaling"
// New creates a new instance of the ApplicationAutoScaling client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a ApplicationAutoScaling client from just a session.
// svc := applicationautoscaling.New(mySession)
//
// // Create a ApplicationAutoScaling client with additional configuration
// svc := applicationautoscaling.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *ApplicationAutoScaling {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ApplicationAutoScaling {
svc := &ApplicationAutoScaling{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: "application-autoscaling",
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-02-06",
JSONVersion: "1.1",
TargetPrefix: "AnyScaleFrontendService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a ApplicationAutoScaling operation and runs any
// custom request initialization.
func (c *ApplicationAutoScaling) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,54 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package applicationdiscoveryserviceiface provides an interface for the AWS Application Discovery Service.
package applicationdiscoveryserviceiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/applicationdiscoveryservice"
)
// ApplicationDiscoveryServiceAPI is the interface type for applicationdiscoveryservice.ApplicationDiscoveryService.
type ApplicationDiscoveryServiceAPI interface {
CreateTagsRequest(*applicationdiscoveryservice.CreateTagsInput) (*request.Request, *applicationdiscoveryservice.CreateTagsOutput)
CreateTags(*applicationdiscoveryservice.CreateTagsInput) (*applicationdiscoveryservice.CreateTagsOutput, error)
DeleteTagsRequest(*applicationdiscoveryservice.DeleteTagsInput) (*request.Request, *applicationdiscoveryservice.DeleteTagsOutput)
DeleteTags(*applicationdiscoveryservice.DeleteTagsInput) (*applicationdiscoveryservice.DeleteTagsOutput, error)
DescribeAgentsRequest(*applicationdiscoveryservice.DescribeAgentsInput) (*request.Request, *applicationdiscoveryservice.DescribeAgentsOutput)
DescribeAgents(*applicationdiscoveryservice.DescribeAgentsInput) (*applicationdiscoveryservice.DescribeAgentsOutput, error)
DescribeConfigurationsRequest(*applicationdiscoveryservice.DescribeConfigurationsInput) (*request.Request, *applicationdiscoveryservice.DescribeConfigurationsOutput)
DescribeConfigurations(*applicationdiscoveryservice.DescribeConfigurationsInput) (*applicationdiscoveryservice.DescribeConfigurationsOutput, error)
DescribeExportConfigurationsRequest(*applicationdiscoveryservice.DescribeExportConfigurationsInput) (*request.Request, *applicationdiscoveryservice.DescribeExportConfigurationsOutput)
DescribeExportConfigurations(*applicationdiscoveryservice.DescribeExportConfigurationsInput) (*applicationdiscoveryservice.DescribeExportConfigurationsOutput, error)
DescribeTagsRequest(*applicationdiscoveryservice.DescribeTagsInput) (*request.Request, *applicationdiscoveryservice.DescribeTagsOutput)
DescribeTags(*applicationdiscoveryservice.DescribeTagsInput) (*applicationdiscoveryservice.DescribeTagsOutput, error)
ExportConfigurationsRequest(*applicationdiscoveryservice.ExportConfigurationsInput) (*request.Request, *applicationdiscoveryservice.ExportConfigurationsOutput)
ExportConfigurations(*applicationdiscoveryservice.ExportConfigurationsInput) (*applicationdiscoveryservice.ExportConfigurationsOutput, error)
ListConfigurationsRequest(*applicationdiscoveryservice.ListConfigurationsInput) (*request.Request, *applicationdiscoveryservice.ListConfigurationsOutput)
ListConfigurations(*applicationdiscoveryservice.ListConfigurationsInput) (*applicationdiscoveryservice.ListConfigurationsOutput, error)
StartDataCollectionByAgentIdsRequest(*applicationdiscoveryservice.StartDataCollectionByAgentIdsInput) (*request.Request, *applicationdiscoveryservice.StartDataCollectionByAgentIdsOutput)
StartDataCollectionByAgentIds(*applicationdiscoveryservice.StartDataCollectionByAgentIdsInput) (*applicationdiscoveryservice.StartDataCollectionByAgentIdsOutput, error)
StopDataCollectionByAgentIdsRequest(*applicationdiscoveryservice.StopDataCollectionByAgentIdsInput) (*request.Request, *applicationdiscoveryservice.StopDataCollectionByAgentIdsOutput)
StopDataCollectionByAgentIds(*applicationdiscoveryservice.StopDataCollectionByAgentIdsInput) (*applicationdiscoveryservice.StopDataCollectionByAgentIdsOutput, error)
}
var _ ApplicationDiscoveryServiceAPI = (*applicationdiscoveryservice.ApplicationDiscoveryService)(nil)

View File

@@ -1,267 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package applicationdiscoveryservice_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/applicationdiscoveryservice"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleApplicationDiscoveryService_CreateTags() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.CreateTagsInput{
ConfigurationIds: []*string{ // Required
aws.String("ConfigurationId"), // Required
// More values...
},
Tags: []*applicationdiscoveryservice.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"), // Required
},
// More values...
},
}
resp, err := svc.CreateTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_DeleteTags() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.DeleteTagsInput{
ConfigurationIds: []*string{ // Required
aws.String("ConfigurationId"), // Required
// More values...
},
Tags: []*applicationdiscoveryservice.Tag{
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"), // Required
},
// More values...
},
}
resp, err := svc.DeleteTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_DescribeAgents() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.DescribeAgentsInput{
AgentIds: []*string{
aws.String("AgentId"), // Required
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeAgents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_DescribeConfigurations() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.DescribeConfigurationsInput{
ConfigurationIds: []*string{ // Required
aws.String("ConfigurationId"), // Required
// More values...
},
}
resp, err := svc.DescribeConfigurations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_DescribeExportConfigurations() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.DescribeExportConfigurationsInput{
ExportIds: []*string{
aws.String("ConfigurationsExportId"), // Required
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeExportConfigurations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_DescribeTags() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.DescribeTagsInput{
Filters: []*applicationdiscoveryservice.TagFilter{
{ // Required
Name: aws.String("FilterName"), // Required
Values: []*string{ // Required
aws.String("FilterValue"), // Required
// More values...
},
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_ExportConfigurations() {
svc := applicationdiscoveryservice.New(session.New())
var params *applicationdiscoveryservice.ExportConfigurationsInput
resp, err := svc.ExportConfigurations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_ListConfigurations() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.ListConfigurationsInput{
ConfigurationType: aws.String("ConfigurationItemType"), // Required
Filters: []*applicationdiscoveryservice.Filter{
{ // Required
Condition: aws.String("Condition"), // Required
Name: aws.String("String"), // Required
Values: []*string{ // Required
aws.String("FilterValue"), // Required
// More values...
},
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListConfigurations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_StartDataCollectionByAgentIds() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.StartDataCollectionByAgentIdsInput{
AgentIds: []*string{ // Required
aws.String("AgentId"), // Required
// More values...
},
}
resp, err := svc.StartDataCollectionByAgentIds(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleApplicationDiscoveryService_StopDataCollectionByAgentIds() {
svc := applicationdiscoveryservice.New(session.New())
params := &applicationdiscoveryservice.StopDataCollectionByAgentIdsInput{
AgentIds: []*string{ // Required
aws.String("AgentId"), // Required
// More values...
},
}
resp, err := svc.StopDataCollectionByAgentIds(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,282 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package applicationdiscoveryservice
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// The AWS Application Discovery Service helps Systems Integrators quickly and
// reliably plan application migration projects by automatically identifying
// applications running in on-premises data centers, their associated dependencies,
// and their performance profile.
//
// Planning data center migrations can involve thousands of workloads that
// are often deeply interdependent. Application discovery and dependency mapping
// are important early first steps in the migration process, but difficult to
// perform at scale due to the lack of automated tools.
//
// The AWS Application Discovery Service automatically collects configuration
// and usage data from servers to develop a list of applications, how they perform,
// and how they are interdependent. This information is securely retained in
// an AWS Application Discovery Service database which you can export as a CSV
// file into your preferred visualization tool or cloud migration solution to
// help reduce the complexity and time in planning your cloud migration.
//
// The Application Discovery Service is currently available for preview. Only
// customers who are engaged with AWS Professional Services (https://aws.amazon.com/professional-services/)
// or a certified AWS partner can use the service. To see the list of certified
// partners and request access to the Application Discovery Service, complete
// the following preview form (http://aws.amazon.com/application-discovery/preview/).
//
// This API reference provides descriptions, syntax, and usage examples for
// each of the actions and data types for the Discovery Service. The topic for
// each action shows the API request parameters and the response. Alternatively,
// you can use one of the AWS SDKs to access an API that is tailored to the
// programming language or platform that you're using. For more information,
// see AWS SDKs (http://aws.amazon.com/tools/#SDKs).
//
// This guide is intended for use with the AWS Discovery Service User Guide
// (http://docs.aws.amazon.com/application-discovery/latest/userguide/what-is-appdiscovery.html).
//
// The following are short descriptions of each API action, organized by function.
//
// Managing AWS Agents Using the Application Discovery Service
//
// An AWS agent is software that you install on on-premises servers and virtual
// machines that are targeted for discovery and migration. Agents run on Linux
// and Windows Server and collect server configuration and activity information
// about your applications and infrastructure. Specifically, agents collect
// the following information and send it to the Application Discovery Service
// using Secure Sockets Layer (SSL) encryption:
//
// User information (user name, home directory)
//
// Group information (name)
//
// List of installed packages
//
// List of kernel modules
//
// All create and stop process events
//
// DNS queries
//
// NIC information
//
// TCP/UDP process listening ports
//
// TCPV4/V6 connections
//
// Operating system information
//
// System performance
//
// Process performance
//
// The Application Discovery Service API includes the following actions to
// manage AWS agents:
//
// StartDataCollectionByAgentIds: Instructs the specified agents to start
// collecting data. The Application Discovery Service takes several minutes
// to receive and process data after you initiate data collection.
//
// StopDataCollectionByAgentIds: Instructs the specified agents to stop
// collecting data.
//
// DescribeAgents: Lists AWS agents by ID or lists all agents associated
// with your user account if you did not specify an agent ID. The output includes
// agent IDs, IP addresses, media access control (MAC) addresses, agent health,
// host name where the agent resides, and the version number of each agent.
//
// Querying Configuration Items
//
// A configuration item is an IT asset that was discovered in your data center
// by an AWS agent. When you use the Application Discovery Service, you can
// specify filters and query specific configuration items. The service supports
// Server, Process, and Connection configuration items. This means you can specify
// a value for the following keys and query your IT assets:
//
// Server server.HostName
//
// server.osName
//
// server.osVersion
//
// server.configurationId
//
// server.agentId
//
// Process process.name
//
// process.CommandLine
//
// process.configurationId
//
// server.hostName
//
// server.osName
//
// server.osVersion
//
// server.configurationId
//
// server.agentId
//
// Connection connection.sourceIp
//
// connection.sourcePort
//
// connection.destinationIp
//
// connection.destinationPort
//
// sourceProcess.configurationId
//
// sourceProcess.commandLine
//
// sourceProcess.name
//
// destinationProcessId.configurationId
//
// destinationProcess.commandLine
//
// destinationProcess.name
//
// sourceServer.configurationId
//
// sourceServer.hostName
//
// sourceServer.osName
//
// sourceServer.osVersion
//
// destinationServer.configurationId
//
// destinationServer.hostName
//
// destinationServer.osName
//
// destinationServer.osVersion
//
// The Application Discovery Service includes the following actions for querying
// configuration items.
//
// DescribeConfigurations: Retrieves a list of attributes for a specific
// configuration ID. For example, the output for a server configuration item
// includes a list of attributes about the server, including host name, operating
// system, number of network cards, etc.
//
// ListConfigurations: Retrieves a list of configuration items according
// to the criteria you specify in a filter. The filter criteria identify relationship
// requirements. For example, you can specify filter criteria of process.name
// with values of nginx and apache.
//
// Tagging Discovered Configuration Items
//
// You can tag discovered configuration items. Tags are metadata that help
// you categorize IT assets in your data center. Tags use a key-value format.
// For example, {"key": "serverType", "value": "webServer"}.
//
// CreateTags: Creates one or more tags for a configuration items.
//
// DescribeTags: Retrieves a list of configuration items that are tagged
// with a specific tag. Or, retrieves a list of all tags assigned to a specific
// configuration item.
//
// DeleteTags: Deletes the association between a configuration item and
// one or more tags.
//
// Exporting Data
//
// You can export data as a CSV file to an Amazon S3 bucket or into your preferred
// visualization tool or cloud migration solution to help reduce the complexity
// and time in planning your cloud migration.
//
// ExportConfigurations: Exports all discovered configuration data to an
// Amazon S3 bucket. Data includes tags and tag associations, processes, connections,
// servers, and system performance. This API returns an export ID which you
// can query using the GetExportStatus API.
//
// DescribeExportConfigurations: Gets the status of the data export. When
// the export is complete, the service returns an Amazon S3 URL where you can
// download CSV files that include the data.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type ApplicationDiscoveryService struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "discovery"
// New creates a new instance of the ApplicationDiscoveryService client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a ApplicationDiscoveryService client from just a session.
// svc := applicationdiscoveryservice.New(mySession)
//
// // Create a ApplicationDiscoveryService client with additional configuration
// svc := applicationdiscoveryservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *ApplicationDiscoveryService {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ApplicationDiscoveryService {
svc := &ApplicationDiscoveryService{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-11-01",
JSONVersion: "1.1",
TargetPrefix: "AWSPoseidonService_V2015_11_01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a ApplicationDiscoveryService operation and runs any
// custom request initialization.
func (c *ApplicationDiscoveryService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,226 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package autoscalingiface provides an interface for the Auto Scaling.
package autoscalingiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/autoscaling"
)
// AutoScalingAPI is the interface type for autoscaling.AutoScaling.
type AutoScalingAPI interface {
AttachInstancesRequest(*autoscaling.AttachInstancesInput) (*request.Request, *autoscaling.AttachInstancesOutput)
AttachInstances(*autoscaling.AttachInstancesInput) (*autoscaling.AttachInstancesOutput, error)
AttachLoadBalancersRequest(*autoscaling.AttachLoadBalancersInput) (*request.Request, *autoscaling.AttachLoadBalancersOutput)
AttachLoadBalancers(*autoscaling.AttachLoadBalancersInput) (*autoscaling.AttachLoadBalancersOutput, error)
CompleteLifecycleActionRequest(*autoscaling.CompleteLifecycleActionInput) (*request.Request, *autoscaling.CompleteLifecycleActionOutput)
CompleteLifecycleAction(*autoscaling.CompleteLifecycleActionInput) (*autoscaling.CompleteLifecycleActionOutput, error)
CreateAutoScalingGroupRequest(*autoscaling.CreateAutoScalingGroupInput) (*request.Request, *autoscaling.CreateAutoScalingGroupOutput)
CreateAutoScalingGroup(*autoscaling.CreateAutoScalingGroupInput) (*autoscaling.CreateAutoScalingGroupOutput, error)
CreateLaunchConfigurationRequest(*autoscaling.CreateLaunchConfigurationInput) (*request.Request, *autoscaling.CreateLaunchConfigurationOutput)
CreateLaunchConfiguration(*autoscaling.CreateLaunchConfigurationInput) (*autoscaling.CreateLaunchConfigurationOutput, error)
CreateOrUpdateTagsRequest(*autoscaling.CreateOrUpdateTagsInput) (*request.Request, *autoscaling.CreateOrUpdateTagsOutput)
CreateOrUpdateTags(*autoscaling.CreateOrUpdateTagsInput) (*autoscaling.CreateOrUpdateTagsOutput, error)
DeleteAutoScalingGroupRequest(*autoscaling.DeleteAutoScalingGroupInput) (*request.Request, *autoscaling.DeleteAutoScalingGroupOutput)
DeleteAutoScalingGroup(*autoscaling.DeleteAutoScalingGroupInput) (*autoscaling.DeleteAutoScalingGroupOutput, error)
DeleteLaunchConfigurationRequest(*autoscaling.DeleteLaunchConfigurationInput) (*request.Request, *autoscaling.DeleteLaunchConfigurationOutput)
DeleteLaunchConfiguration(*autoscaling.DeleteLaunchConfigurationInput) (*autoscaling.DeleteLaunchConfigurationOutput, error)
DeleteLifecycleHookRequest(*autoscaling.DeleteLifecycleHookInput) (*request.Request, *autoscaling.DeleteLifecycleHookOutput)
DeleteLifecycleHook(*autoscaling.DeleteLifecycleHookInput) (*autoscaling.DeleteLifecycleHookOutput, error)
DeleteNotificationConfigurationRequest(*autoscaling.DeleteNotificationConfigurationInput) (*request.Request, *autoscaling.DeleteNotificationConfigurationOutput)
DeleteNotificationConfiguration(*autoscaling.DeleteNotificationConfigurationInput) (*autoscaling.DeleteNotificationConfigurationOutput, error)
DeletePolicyRequest(*autoscaling.DeletePolicyInput) (*request.Request, *autoscaling.DeletePolicyOutput)
DeletePolicy(*autoscaling.DeletePolicyInput) (*autoscaling.DeletePolicyOutput, error)
DeleteScheduledActionRequest(*autoscaling.DeleteScheduledActionInput) (*request.Request, *autoscaling.DeleteScheduledActionOutput)
DeleteScheduledAction(*autoscaling.DeleteScheduledActionInput) (*autoscaling.DeleteScheduledActionOutput, error)
DeleteTagsRequest(*autoscaling.DeleteTagsInput) (*request.Request, *autoscaling.DeleteTagsOutput)
DeleteTags(*autoscaling.DeleteTagsInput) (*autoscaling.DeleteTagsOutput, error)
DescribeAccountLimitsRequest(*autoscaling.DescribeAccountLimitsInput) (*request.Request, *autoscaling.DescribeAccountLimitsOutput)
DescribeAccountLimits(*autoscaling.DescribeAccountLimitsInput) (*autoscaling.DescribeAccountLimitsOutput, error)
DescribeAdjustmentTypesRequest(*autoscaling.DescribeAdjustmentTypesInput) (*request.Request, *autoscaling.DescribeAdjustmentTypesOutput)
DescribeAdjustmentTypes(*autoscaling.DescribeAdjustmentTypesInput) (*autoscaling.DescribeAdjustmentTypesOutput, error)
DescribeAutoScalingGroupsRequest(*autoscaling.DescribeAutoScalingGroupsInput) (*request.Request, *autoscaling.DescribeAutoScalingGroupsOutput)
DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error)
DescribeAutoScalingGroupsPages(*autoscaling.DescribeAutoScalingGroupsInput, func(*autoscaling.DescribeAutoScalingGroupsOutput, bool) bool) error
DescribeAutoScalingInstancesRequest(*autoscaling.DescribeAutoScalingInstancesInput) (*request.Request, *autoscaling.DescribeAutoScalingInstancesOutput)
DescribeAutoScalingInstances(*autoscaling.DescribeAutoScalingInstancesInput) (*autoscaling.DescribeAutoScalingInstancesOutput, error)
DescribeAutoScalingInstancesPages(*autoscaling.DescribeAutoScalingInstancesInput, func(*autoscaling.DescribeAutoScalingInstancesOutput, bool) bool) error
DescribeAutoScalingNotificationTypesRequest(*autoscaling.DescribeAutoScalingNotificationTypesInput) (*request.Request, *autoscaling.DescribeAutoScalingNotificationTypesOutput)
DescribeAutoScalingNotificationTypes(*autoscaling.DescribeAutoScalingNotificationTypesInput) (*autoscaling.DescribeAutoScalingNotificationTypesOutput, error)
DescribeLaunchConfigurationsRequest(*autoscaling.DescribeLaunchConfigurationsInput) (*request.Request, *autoscaling.DescribeLaunchConfigurationsOutput)
DescribeLaunchConfigurations(*autoscaling.DescribeLaunchConfigurationsInput) (*autoscaling.DescribeLaunchConfigurationsOutput, error)
DescribeLaunchConfigurationsPages(*autoscaling.DescribeLaunchConfigurationsInput, func(*autoscaling.DescribeLaunchConfigurationsOutput, bool) bool) error
DescribeLifecycleHookTypesRequest(*autoscaling.DescribeLifecycleHookTypesInput) (*request.Request, *autoscaling.DescribeLifecycleHookTypesOutput)
DescribeLifecycleHookTypes(*autoscaling.DescribeLifecycleHookTypesInput) (*autoscaling.DescribeLifecycleHookTypesOutput, error)
DescribeLifecycleHooksRequest(*autoscaling.DescribeLifecycleHooksInput) (*request.Request, *autoscaling.DescribeLifecycleHooksOutput)
DescribeLifecycleHooks(*autoscaling.DescribeLifecycleHooksInput) (*autoscaling.DescribeLifecycleHooksOutput, error)
DescribeLoadBalancersRequest(*autoscaling.DescribeLoadBalancersInput) (*request.Request, *autoscaling.DescribeLoadBalancersOutput)
DescribeLoadBalancers(*autoscaling.DescribeLoadBalancersInput) (*autoscaling.DescribeLoadBalancersOutput, error)
DescribeMetricCollectionTypesRequest(*autoscaling.DescribeMetricCollectionTypesInput) (*request.Request, *autoscaling.DescribeMetricCollectionTypesOutput)
DescribeMetricCollectionTypes(*autoscaling.DescribeMetricCollectionTypesInput) (*autoscaling.DescribeMetricCollectionTypesOutput, error)
DescribeNotificationConfigurationsRequest(*autoscaling.DescribeNotificationConfigurationsInput) (*request.Request, *autoscaling.DescribeNotificationConfigurationsOutput)
DescribeNotificationConfigurations(*autoscaling.DescribeNotificationConfigurationsInput) (*autoscaling.DescribeNotificationConfigurationsOutput, error)
DescribeNotificationConfigurationsPages(*autoscaling.DescribeNotificationConfigurationsInput, func(*autoscaling.DescribeNotificationConfigurationsOutput, bool) bool) error
DescribePoliciesRequest(*autoscaling.DescribePoliciesInput) (*request.Request, *autoscaling.DescribePoliciesOutput)
DescribePolicies(*autoscaling.DescribePoliciesInput) (*autoscaling.DescribePoliciesOutput, error)
DescribePoliciesPages(*autoscaling.DescribePoliciesInput, func(*autoscaling.DescribePoliciesOutput, bool) bool) error
DescribeScalingActivitiesRequest(*autoscaling.DescribeScalingActivitiesInput) (*request.Request, *autoscaling.DescribeScalingActivitiesOutput)
DescribeScalingActivities(*autoscaling.DescribeScalingActivitiesInput) (*autoscaling.DescribeScalingActivitiesOutput, error)
DescribeScalingActivitiesPages(*autoscaling.DescribeScalingActivitiesInput, func(*autoscaling.DescribeScalingActivitiesOutput, bool) bool) error
DescribeScalingProcessTypesRequest(*autoscaling.DescribeScalingProcessTypesInput) (*request.Request, *autoscaling.DescribeScalingProcessTypesOutput)
DescribeScalingProcessTypes(*autoscaling.DescribeScalingProcessTypesInput) (*autoscaling.DescribeScalingProcessTypesOutput, error)
DescribeScheduledActionsRequest(*autoscaling.DescribeScheduledActionsInput) (*request.Request, *autoscaling.DescribeScheduledActionsOutput)
DescribeScheduledActions(*autoscaling.DescribeScheduledActionsInput) (*autoscaling.DescribeScheduledActionsOutput, error)
DescribeScheduledActionsPages(*autoscaling.DescribeScheduledActionsInput, func(*autoscaling.DescribeScheduledActionsOutput, bool) bool) error
DescribeTagsRequest(*autoscaling.DescribeTagsInput) (*request.Request, *autoscaling.DescribeTagsOutput)
DescribeTags(*autoscaling.DescribeTagsInput) (*autoscaling.DescribeTagsOutput, error)
DescribeTagsPages(*autoscaling.DescribeTagsInput, func(*autoscaling.DescribeTagsOutput, bool) bool) error
DescribeTerminationPolicyTypesRequest(*autoscaling.DescribeTerminationPolicyTypesInput) (*request.Request, *autoscaling.DescribeTerminationPolicyTypesOutput)
DescribeTerminationPolicyTypes(*autoscaling.DescribeTerminationPolicyTypesInput) (*autoscaling.DescribeTerminationPolicyTypesOutput, error)
DetachInstancesRequest(*autoscaling.DetachInstancesInput) (*request.Request, *autoscaling.DetachInstancesOutput)
DetachInstances(*autoscaling.DetachInstancesInput) (*autoscaling.DetachInstancesOutput, error)
DetachLoadBalancersRequest(*autoscaling.DetachLoadBalancersInput) (*request.Request, *autoscaling.DetachLoadBalancersOutput)
DetachLoadBalancers(*autoscaling.DetachLoadBalancersInput) (*autoscaling.DetachLoadBalancersOutput, error)
DisableMetricsCollectionRequest(*autoscaling.DisableMetricsCollectionInput) (*request.Request, *autoscaling.DisableMetricsCollectionOutput)
DisableMetricsCollection(*autoscaling.DisableMetricsCollectionInput) (*autoscaling.DisableMetricsCollectionOutput, error)
EnableMetricsCollectionRequest(*autoscaling.EnableMetricsCollectionInput) (*request.Request, *autoscaling.EnableMetricsCollectionOutput)
EnableMetricsCollection(*autoscaling.EnableMetricsCollectionInput) (*autoscaling.EnableMetricsCollectionOutput, error)
EnterStandbyRequest(*autoscaling.EnterStandbyInput) (*request.Request, *autoscaling.EnterStandbyOutput)
EnterStandby(*autoscaling.EnterStandbyInput) (*autoscaling.EnterStandbyOutput, error)
ExecutePolicyRequest(*autoscaling.ExecutePolicyInput) (*request.Request, *autoscaling.ExecutePolicyOutput)
ExecutePolicy(*autoscaling.ExecutePolicyInput) (*autoscaling.ExecutePolicyOutput, error)
ExitStandbyRequest(*autoscaling.ExitStandbyInput) (*request.Request, *autoscaling.ExitStandbyOutput)
ExitStandby(*autoscaling.ExitStandbyInput) (*autoscaling.ExitStandbyOutput, error)
PutLifecycleHookRequest(*autoscaling.PutLifecycleHookInput) (*request.Request, *autoscaling.PutLifecycleHookOutput)
PutLifecycleHook(*autoscaling.PutLifecycleHookInput) (*autoscaling.PutLifecycleHookOutput, error)
PutNotificationConfigurationRequest(*autoscaling.PutNotificationConfigurationInput) (*request.Request, *autoscaling.PutNotificationConfigurationOutput)
PutNotificationConfiguration(*autoscaling.PutNotificationConfigurationInput) (*autoscaling.PutNotificationConfigurationOutput, error)
PutScalingPolicyRequest(*autoscaling.PutScalingPolicyInput) (*request.Request, *autoscaling.PutScalingPolicyOutput)
PutScalingPolicy(*autoscaling.PutScalingPolicyInput) (*autoscaling.PutScalingPolicyOutput, error)
PutScheduledUpdateGroupActionRequest(*autoscaling.PutScheduledUpdateGroupActionInput) (*request.Request, *autoscaling.PutScheduledUpdateGroupActionOutput)
PutScheduledUpdateGroupAction(*autoscaling.PutScheduledUpdateGroupActionInput) (*autoscaling.PutScheduledUpdateGroupActionOutput, error)
RecordLifecycleActionHeartbeatRequest(*autoscaling.RecordLifecycleActionHeartbeatInput) (*request.Request, *autoscaling.RecordLifecycleActionHeartbeatOutput)
RecordLifecycleActionHeartbeat(*autoscaling.RecordLifecycleActionHeartbeatInput) (*autoscaling.RecordLifecycleActionHeartbeatOutput, error)
ResumeProcessesRequest(*autoscaling.ScalingProcessQuery) (*request.Request, *autoscaling.ResumeProcessesOutput)
ResumeProcesses(*autoscaling.ScalingProcessQuery) (*autoscaling.ResumeProcessesOutput, error)
SetDesiredCapacityRequest(*autoscaling.SetDesiredCapacityInput) (*request.Request, *autoscaling.SetDesiredCapacityOutput)
SetDesiredCapacity(*autoscaling.SetDesiredCapacityInput) (*autoscaling.SetDesiredCapacityOutput, error)
SetInstanceHealthRequest(*autoscaling.SetInstanceHealthInput) (*request.Request, *autoscaling.SetInstanceHealthOutput)
SetInstanceHealth(*autoscaling.SetInstanceHealthInput) (*autoscaling.SetInstanceHealthOutput, error)
SetInstanceProtectionRequest(*autoscaling.SetInstanceProtectionInput) (*request.Request, *autoscaling.SetInstanceProtectionOutput)
SetInstanceProtection(*autoscaling.SetInstanceProtectionInput) (*autoscaling.SetInstanceProtectionOutput, error)
SuspendProcessesRequest(*autoscaling.ScalingProcessQuery) (*request.Request, *autoscaling.SuspendProcessesOutput)
SuspendProcesses(*autoscaling.ScalingProcessQuery) (*autoscaling.SuspendProcessesOutput, error)
TerminateInstanceInAutoScalingGroupRequest(*autoscaling.TerminateInstanceInAutoScalingGroupInput) (*request.Request, *autoscaling.TerminateInstanceInAutoScalingGroupOutput)
TerminateInstanceInAutoScalingGroup(*autoscaling.TerminateInstanceInAutoScalingGroupInput) (*autoscaling.TerminateInstanceInAutoScalingGroupOutput, error)
UpdateAutoScalingGroupRequest(*autoscaling.UpdateAutoScalingGroupInput) (*request.Request, *autoscaling.UpdateAutoScalingGroupOutput)
UpdateAutoScalingGroup(*autoscaling.UpdateAutoScalingGroupInput) (*autoscaling.UpdateAutoScalingGroupOutput, error)
}
var _ AutoScalingAPI = (*autoscaling.AutoScaling)(nil)

File diff suppressed because it is too large Load Diff

View File

@@ -1,88 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package autoscaling
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// Auto Scaling is designed to automatically launch or terminate EC2 instances
// based on user-defined policies, schedules, and health checks. Use this service
// in conjunction with the Amazon CloudWatch and Elastic Load Balancing services.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type AutoScaling struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "autoscaling"
// New creates a new instance of the AutoScaling client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a AutoScaling client from just a session.
// svc := autoscaling.New(mySession)
//
// // Create a AutoScaling client with additional configuration
// svc := autoscaling.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *AutoScaling {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *AutoScaling {
svc := &AutoScaling{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2011-01-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a AutoScaling operation and runs any
// custom request initialization.
func (c *AutoScaling) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View File

@@ -1,94 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package autoscaling
import (
"github.com/aws/aws-sdk-go/private/waiter"
)
func (c *AutoScaling) WaitUntilGroupExists(input *DescribeAutoScalingGroupsInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeAutoScalingGroups",
Delay: 5,
MaxAttempts: 10,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "length(AutoScalingGroups) > `0`",
Expected: true,
},
{
State: "retry",
Matcher: "path",
Argument: "length(AutoScalingGroups) > `0`",
Expected: false,
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *AutoScaling) WaitUntilGroupInService(input *DescribeAutoScalingGroupsInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeAutoScalingGroups",
Delay: 15,
MaxAttempts: 40,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)",
Expected: false,
},
{
State: "retry",
Matcher: "path",
Argument: "contains(AutoScalingGroups[].[length(Instances[?LifecycleState=='InService']) >= MinSize][], `false`)",
Expected: true,
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *AutoScaling) WaitUntilGroupNotExists(input *DescribeAutoScalingGroupsInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeAutoScalingGroups",
Delay: 15,
MaxAttempts: 40,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "length(AutoScalingGroups) > `0`",
Expected: false,
},
{
State: "retry",
Matcher: "path",
Argument: "length(AutoScalingGroups) > `0`",
Expected: true,
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,118 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudformationiface provides an interface for the AWS CloudFormation.
package cloudformationiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudformation"
)
// CloudFormationAPI is the interface type for cloudformation.CloudFormation.
type CloudFormationAPI interface {
CancelUpdateStackRequest(*cloudformation.CancelUpdateStackInput) (*request.Request, *cloudformation.CancelUpdateStackOutput)
CancelUpdateStack(*cloudformation.CancelUpdateStackInput) (*cloudformation.CancelUpdateStackOutput, error)
ContinueUpdateRollbackRequest(*cloudformation.ContinueUpdateRollbackInput) (*request.Request, *cloudformation.ContinueUpdateRollbackOutput)
ContinueUpdateRollback(*cloudformation.ContinueUpdateRollbackInput) (*cloudformation.ContinueUpdateRollbackOutput, error)
CreateChangeSetRequest(*cloudformation.CreateChangeSetInput) (*request.Request, *cloudformation.CreateChangeSetOutput)
CreateChangeSet(*cloudformation.CreateChangeSetInput) (*cloudformation.CreateChangeSetOutput, error)
CreateStackRequest(*cloudformation.CreateStackInput) (*request.Request, *cloudformation.CreateStackOutput)
CreateStack(*cloudformation.CreateStackInput) (*cloudformation.CreateStackOutput, error)
DeleteChangeSetRequest(*cloudformation.DeleteChangeSetInput) (*request.Request, *cloudformation.DeleteChangeSetOutput)
DeleteChangeSet(*cloudformation.DeleteChangeSetInput) (*cloudformation.DeleteChangeSetOutput, error)
DeleteStackRequest(*cloudformation.DeleteStackInput) (*request.Request, *cloudformation.DeleteStackOutput)
DeleteStack(*cloudformation.DeleteStackInput) (*cloudformation.DeleteStackOutput, error)
DescribeAccountLimitsRequest(*cloudformation.DescribeAccountLimitsInput) (*request.Request, *cloudformation.DescribeAccountLimitsOutput)
DescribeAccountLimits(*cloudformation.DescribeAccountLimitsInput) (*cloudformation.DescribeAccountLimitsOutput, error)
DescribeChangeSetRequest(*cloudformation.DescribeChangeSetInput) (*request.Request, *cloudformation.DescribeChangeSetOutput)
DescribeChangeSet(*cloudformation.DescribeChangeSetInput) (*cloudformation.DescribeChangeSetOutput, error)
DescribeStackEventsRequest(*cloudformation.DescribeStackEventsInput) (*request.Request, *cloudformation.DescribeStackEventsOutput)
DescribeStackEvents(*cloudformation.DescribeStackEventsInput) (*cloudformation.DescribeStackEventsOutput, error)
DescribeStackEventsPages(*cloudformation.DescribeStackEventsInput, func(*cloudformation.DescribeStackEventsOutput, bool) bool) error
DescribeStackResourceRequest(*cloudformation.DescribeStackResourceInput) (*request.Request, *cloudformation.DescribeStackResourceOutput)
DescribeStackResource(*cloudformation.DescribeStackResourceInput) (*cloudformation.DescribeStackResourceOutput, error)
DescribeStackResourcesRequest(*cloudformation.DescribeStackResourcesInput) (*request.Request, *cloudformation.DescribeStackResourcesOutput)
DescribeStackResources(*cloudformation.DescribeStackResourcesInput) (*cloudformation.DescribeStackResourcesOutput, error)
DescribeStacksRequest(*cloudformation.DescribeStacksInput) (*request.Request, *cloudformation.DescribeStacksOutput)
DescribeStacks(*cloudformation.DescribeStacksInput) (*cloudformation.DescribeStacksOutput, error)
DescribeStacksPages(*cloudformation.DescribeStacksInput, func(*cloudformation.DescribeStacksOutput, bool) bool) error
EstimateTemplateCostRequest(*cloudformation.EstimateTemplateCostInput) (*request.Request, *cloudformation.EstimateTemplateCostOutput)
EstimateTemplateCost(*cloudformation.EstimateTemplateCostInput) (*cloudformation.EstimateTemplateCostOutput, error)
ExecuteChangeSetRequest(*cloudformation.ExecuteChangeSetInput) (*request.Request, *cloudformation.ExecuteChangeSetOutput)
ExecuteChangeSet(*cloudformation.ExecuteChangeSetInput) (*cloudformation.ExecuteChangeSetOutput, error)
GetStackPolicyRequest(*cloudformation.GetStackPolicyInput) (*request.Request, *cloudformation.GetStackPolicyOutput)
GetStackPolicy(*cloudformation.GetStackPolicyInput) (*cloudformation.GetStackPolicyOutput, error)
GetTemplateRequest(*cloudformation.GetTemplateInput) (*request.Request, *cloudformation.GetTemplateOutput)
GetTemplate(*cloudformation.GetTemplateInput) (*cloudformation.GetTemplateOutput, error)
GetTemplateSummaryRequest(*cloudformation.GetTemplateSummaryInput) (*request.Request, *cloudformation.GetTemplateSummaryOutput)
GetTemplateSummary(*cloudformation.GetTemplateSummaryInput) (*cloudformation.GetTemplateSummaryOutput, error)
ListChangeSetsRequest(*cloudformation.ListChangeSetsInput) (*request.Request, *cloudformation.ListChangeSetsOutput)
ListChangeSets(*cloudformation.ListChangeSetsInput) (*cloudformation.ListChangeSetsOutput, error)
ListStackResourcesRequest(*cloudformation.ListStackResourcesInput) (*request.Request, *cloudformation.ListStackResourcesOutput)
ListStackResources(*cloudformation.ListStackResourcesInput) (*cloudformation.ListStackResourcesOutput, error)
ListStackResourcesPages(*cloudformation.ListStackResourcesInput, func(*cloudformation.ListStackResourcesOutput, bool) bool) error
ListStacksRequest(*cloudformation.ListStacksInput) (*request.Request, *cloudformation.ListStacksOutput)
ListStacks(*cloudformation.ListStacksInput) (*cloudformation.ListStacksOutput, error)
ListStacksPages(*cloudformation.ListStacksInput, func(*cloudformation.ListStacksOutput, bool) bool) error
SetStackPolicyRequest(*cloudformation.SetStackPolicyInput) (*request.Request, *cloudformation.SetStackPolicyOutput)
SetStackPolicy(*cloudformation.SetStackPolicyInput) (*cloudformation.SetStackPolicyOutput, error)
SignalResourceRequest(*cloudformation.SignalResourceInput) (*request.Request, *cloudformation.SignalResourceOutput)
SignalResource(*cloudformation.SignalResourceInput) (*cloudformation.SignalResourceOutput, error)
UpdateStackRequest(*cloudformation.UpdateStackInput) (*request.Request, *cloudformation.UpdateStackOutput)
UpdateStack(*cloudformation.UpdateStackInput) (*cloudformation.UpdateStackOutput, error)
ValidateTemplateRequest(*cloudformation.ValidateTemplateInput) (*request.Request, *cloudformation.ValidateTemplateOutput)
ValidateTemplate(*cloudformation.ValidateTemplateInput) (*cloudformation.ValidateTemplateOutput, error)
}
var _ CloudFormationAPI = (*cloudformation.CloudFormation)(nil)

View File

@@ -1,609 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudformation"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudFormation_CancelUpdateStack() {
svc := cloudformation.New(session.New())
params := &cloudformation.CancelUpdateStackInput{
StackName: aws.String("StackName"), // Required
}
resp, err := svc.CancelUpdateStack(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_ContinueUpdateRollback() {
svc := cloudformation.New(session.New())
params := &cloudformation.ContinueUpdateRollbackInput{
StackName: aws.String("StackNameOrId"), // Required
}
resp, err := svc.ContinueUpdateRollback(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_CreateChangeSet() {
svc := cloudformation.New(session.New())
params := &cloudformation.CreateChangeSetInput{
ChangeSetName: aws.String("ChangeSetName"), // Required
StackName: aws.String("StackNameOrId"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
ClientToken: aws.String("ClientToken"),
Description: aws.String("Description"),
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
UsePreviousTemplate: aws.Bool(true),
}
resp, err := svc.CreateChangeSet(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_CreateStack() {
svc := cloudformation.New(session.New())
params := &cloudformation.CreateStackInput{
StackName: aws.String("StackName"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
DisableRollback: aws.Bool(true),
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
OnFailure: aws.String("OnFailure"),
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyURL: aws.String("StackPolicyURL"),
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
TimeoutInMinutes: aws.Int64(1),
}
resp, err := svc.CreateStack(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DeleteChangeSet() {
svc := cloudformation.New(session.New())
params := &cloudformation.DeleteChangeSetInput{
ChangeSetName: aws.String("ChangeSetNameOrId"), // Required
StackName: aws.String("StackNameOrId"),
}
resp, err := svc.DeleteChangeSet(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DeleteStack() {
svc := cloudformation.New(session.New())
params := &cloudformation.DeleteStackInput{
StackName: aws.String("StackName"), // Required
RetainResources: []*string{
aws.String("LogicalResourceId"), // Required
// More values...
},
}
resp, err := svc.DeleteStack(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DescribeAccountLimits() {
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeAccountLimitsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeAccountLimits(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DescribeChangeSet() {
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeChangeSetInput{
ChangeSetName: aws.String("ChangeSetNameOrId"), // Required
NextToken: aws.String("NextToken"),
StackName: aws.String("StackNameOrId"),
}
resp, err := svc.DescribeChangeSet(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DescribeStackEvents() {
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeStackEventsInput{
NextToken: aws.String("NextToken"),
StackName: aws.String("StackName"),
}
resp, err := svc.DescribeStackEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DescribeStackResource() {
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeStackResourceInput{
LogicalResourceId: aws.String("LogicalResourceId"), // Required
StackName: aws.String("StackName"), // Required
}
resp, err := svc.DescribeStackResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DescribeStackResources() {
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeStackResourcesInput{
LogicalResourceId: aws.String("LogicalResourceId"),
PhysicalResourceId: aws.String("PhysicalResourceId"),
StackName: aws.String("StackName"),
}
resp, err := svc.DescribeStackResources(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_DescribeStacks() {
svc := cloudformation.New(session.New())
params := &cloudformation.DescribeStacksInput{
NextToken: aws.String("NextToken"),
StackName: aws.String("StackName"),
}
resp, err := svc.DescribeStacks(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_EstimateTemplateCost() {
svc := cloudformation.New(session.New())
params := &cloudformation.EstimateTemplateCostInput{
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
}
resp, err := svc.EstimateTemplateCost(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_ExecuteChangeSet() {
svc := cloudformation.New(session.New())
params := &cloudformation.ExecuteChangeSetInput{
ChangeSetName: aws.String("ChangeSetNameOrId"), // Required
StackName: aws.String("StackNameOrId"),
}
resp, err := svc.ExecuteChangeSet(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_GetStackPolicy() {
svc := cloudformation.New(session.New())
params := &cloudformation.GetStackPolicyInput{
StackName: aws.String("StackName"), // Required
}
resp, err := svc.GetStackPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_GetTemplate() {
svc := cloudformation.New(session.New())
params := &cloudformation.GetTemplateInput{
StackName: aws.String("StackName"), // Required
}
resp, err := svc.GetTemplate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_GetTemplateSummary() {
svc := cloudformation.New(session.New())
params := &cloudformation.GetTemplateSummaryInput{
StackName: aws.String("StackNameOrId"),
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
}
resp, err := svc.GetTemplateSummary(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_ListChangeSets() {
svc := cloudformation.New(session.New())
params := &cloudformation.ListChangeSetsInput{
StackName: aws.String("StackNameOrId"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListChangeSets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_ListStackResources() {
svc := cloudformation.New(session.New())
params := &cloudformation.ListStackResourcesInput{
StackName: aws.String("StackName"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListStackResources(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_ListStacks() {
svc := cloudformation.New(session.New())
params := &cloudformation.ListStacksInput{
NextToken: aws.String("NextToken"),
StackStatusFilter: []*string{
aws.String("StackStatus"), // Required
// More values...
},
}
resp, err := svc.ListStacks(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_SetStackPolicy() {
svc := cloudformation.New(session.New())
params := &cloudformation.SetStackPolicyInput{
StackName: aws.String("StackName"), // Required
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyURL: aws.String("StackPolicyURL"),
}
resp, err := svc.SetStackPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_SignalResource() {
svc := cloudformation.New(session.New())
params := &cloudformation.SignalResourceInput{
LogicalResourceId: aws.String("LogicalResourceId"), // Required
StackName: aws.String("StackNameOrId"), // Required
Status: aws.String("ResourceSignalStatus"), // Required
UniqueId: aws.String("ResourceSignalUniqueId"), // Required
}
resp, err := svc.SignalResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_UpdateStack() {
svc := cloudformation.New(session.New())
params := &cloudformation.UpdateStackInput{
StackName: aws.String("StackName"), // Required
Capabilities: []*string{
aws.String("Capability"), // Required
// More values...
},
NotificationARNs: []*string{
aws.String("NotificationARN"), // Required
// More values...
},
Parameters: []*cloudformation.Parameter{
{ // Required
ParameterKey: aws.String("ParameterKey"),
ParameterValue: aws.String("ParameterValue"),
UsePreviousValue: aws.Bool(true),
},
// More values...
},
ResourceTypes: []*string{
aws.String("ResourceType"), // Required
// More values...
},
StackPolicyBody: aws.String("StackPolicyBody"),
StackPolicyDuringUpdateBody: aws.String("StackPolicyDuringUpdateBody"),
StackPolicyDuringUpdateURL: aws.String("StackPolicyDuringUpdateURL"),
StackPolicyURL: aws.String("StackPolicyURL"),
Tags: []*cloudformation.Tag{
{ // Required
Key: aws.String("TagKey"),
Value: aws.String("TagValue"),
},
// More values...
},
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
UsePreviousTemplate: aws.Bool(true),
}
resp, err := svc.UpdateStack(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFormation_ValidateTemplate() {
svc := cloudformation.New(session.New())
params := &cloudformation.ValidateTemplateInput{
TemplateBody: aws.String("TemplateBody"),
TemplateURL: aws.String("TemplateURL"),
}
resp, err := svc.ValidateTemplate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,103 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// AWS CloudFormation enables you to create and manage AWS infrastructure deployments
// predictably and repeatedly. AWS CloudFormation helps you leverage AWS products
// such as Amazon EC2, EBS, Amazon SNS, ELB, and Auto Scaling to build highly-reliable,
// highly scalable, cost effective applications without worrying about creating
// and configuring the underlying AWS infrastructure.
//
// With AWS CloudFormation, you declare all of your resources and dependencies
// in a template file. The template defines a collection of resources as a single
// unit called a stack. AWS CloudFormation creates and deletes all member resources
// of the stack together and manages all dependencies between the resources
// for you.
//
// For more information about this product, go to the CloudFormation Product
// Page (http://aws.amazon.com/cloudformation/).
//
// Amazon CloudFormation makes use of other AWS products. If you need additional
// technical information about a specific AWS product, you can find the product's
// technical documentation at http://docs.aws.amazon.com/ (http://docs.aws.amazon.com/).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudFormation struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cloudformation"
// New creates a new instance of the CloudFormation client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudFormation client from just a session.
// svc := cloudformation.New(mySession)
//
// // Create a CloudFormation client with additional configuration
// svc := cloudformation.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudFormation {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudFormation {
svc := &CloudFormation{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2010-05-15",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudFormation operation and runs any
// custom request initialization.
func (c *CloudFormation) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View File

@@ -1,279 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudformation
import (
"github.com/aws/aws-sdk-go/private/waiter"
)
func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeStacks",
Delay: 30,
MaxAttempts: 120,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "pathAll",
Argument: "Stacks[].StackStatus",
Expected: "CREATE_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "CREATE_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "DELETE_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "DELETE_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "DELETE_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_IN_PROGRESS",
},
{
State: "failure",
Matcher: "error",
Argument: "",
Expected: "ValidationError",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeStacks",
Delay: 30,
MaxAttempts: 120,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "pathAll",
Argument: "Stacks[].StackStatus",
Expected: "DELETE_COMPLETE",
},
{
State: "success",
Matcher: "error",
Argument: "",
Expected: "ValidationError",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "DELETE_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "CREATE_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "CREATE_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "CREATE_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "ROLLBACK_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_IN_PROGRESS",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeStacks",
Delay: 5,
MaxAttempts: 20,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "status",
Argument: "",
Expected: 200,
},
{
State: "retry",
Matcher: "error",
Argument: "",
Expected: "ValidationError",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeStacks",
Delay: 30,
MaxAttempts: 120,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "pathAll",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_COMPLETE",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_FAILED",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS",
},
{
State: "failure",
Matcher: "pathAny",
Argument: "Stacks[].StackStatus",
Expected: "UPDATE_ROLLBACK_IN_PROGRESS",
},
{
State: "failure",
Matcher: "error",
Argument: "",
Expected: "ValidationError",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,110 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudfrontiface provides an interface for the Amazon CloudFront.
package cloudfrontiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudfront"
)
// CloudFrontAPI is the interface type for cloudfront.CloudFront.
type CloudFrontAPI interface {
CreateCloudFrontOriginAccessIdentityRequest(*cloudfront.CreateCloudFrontOriginAccessIdentityInput) (*request.Request, *cloudfront.CreateCloudFrontOriginAccessIdentityOutput)
CreateCloudFrontOriginAccessIdentity(*cloudfront.CreateCloudFrontOriginAccessIdentityInput) (*cloudfront.CreateCloudFrontOriginAccessIdentityOutput, error)
CreateDistributionRequest(*cloudfront.CreateDistributionInput) (*request.Request, *cloudfront.CreateDistributionOutput)
CreateDistribution(*cloudfront.CreateDistributionInput) (*cloudfront.CreateDistributionOutput, error)
CreateInvalidationRequest(*cloudfront.CreateInvalidationInput) (*request.Request, *cloudfront.CreateInvalidationOutput)
CreateInvalidation(*cloudfront.CreateInvalidationInput) (*cloudfront.CreateInvalidationOutput, error)
CreateStreamingDistributionRequest(*cloudfront.CreateStreamingDistributionInput) (*request.Request, *cloudfront.CreateStreamingDistributionOutput)
CreateStreamingDistribution(*cloudfront.CreateStreamingDistributionInput) (*cloudfront.CreateStreamingDistributionOutput, error)
DeleteCloudFrontOriginAccessIdentityRequest(*cloudfront.DeleteCloudFrontOriginAccessIdentityInput) (*request.Request, *cloudfront.DeleteCloudFrontOriginAccessIdentityOutput)
DeleteCloudFrontOriginAccessIdentity(*cloudfront.DeleteCloudFrontOriginAccessIdentityInput) (*cloudfront.DeleteCloudFrontOriginAccessIdentityOutput, error)
DeleteDistributionRequest(*cloudfront.DeleteDistributionInput) (*request.Request, *cloudfront.DeleteDistributionOutput)
DeleteDistribution(*cloudfront.DeleteDistributionInput) (*cloudfront.DeleteDistributionOutput, error)
DeleteStreamingDistributionRequest(*cloudfront.DeleteStreamingDistributionInput) (*request.Request, *cloudfront.DeleteStreamingDistributionOutput)
DeleteStreamingDistribution(*cloudfront.DeleteStreamingDistributionInput) (*cloudfront.DeleteStreamingDistributionOutput, error)
GetCloudFrontOriginAccessIdentityRequest(*cloudfront.GetCloudFrontOriginAccessIdentityInput) (*request.Request, *cloudfront.GetCloudFrontOriginAccessIdentityOutput)
GetCloudFrontOriginAccessIdentity(*cloudfront.GetCloudFrontOriginAccessIdentityInput) (*cloudfront.GetCloudFrontOriginAccessIdentityOutput, error)
GetCloudFrontOriginAccessIdentityConfigRequest(*cloudfront.GetCloudFrontOriginAccessIdentityConfigInput) (*request.Request, *cloudfront.GetCloudFrontOriginAccessIdentityConfigOutput)
GetCloudFrontOriginAccessIdentityConfig(*cloudfront.GetCloudFrontOriginAccessIdentityConfigInput) (*cloudfront.GetCloudFrontOriginAccessIdentityConfigOutput, error)
GetDistributionRequest(*cloudfront.GetDistributionInput) (*request.Request, *cloudfront.GetDistributionOutput)
GetDistribution(*cloudfront.GetDistributionInput) (*cloudfront.GetDistributionOutput, error)
GetDistributionConfigRequest(*cloudfront.GetDistributionConfigInput) (*request.Request, *cloudfront.GetDistributionConfigOutput)
GetDistributionConfig(*cloudfront.GetDistributionConfigInput) (*cloudfront.GetDistributionConfigOutput, error)
GetInvalidationRequest(*cloudfront.GetInvalidationInput) (*request.Request, *cloudfront.GetInvalidationOutput)
GetInvalidation(*cloudfront.GetInvalidationInput) (*cloudfront.GetInvalidationOutput, error)
GetStreamingDistributionRequest(*cloudfront.GetStreamingDistributionInput) (*request.Request, *cloudfront.GetStreamingDistributionOutput)
GetStreamingDistribution(*cloudfront.GetStreamingDistributionInput) (*cloudfront.GetStreamingDistributionOutput, error)
GetStreamingDistributionConfigRequest(*cloudfront.GetStreamingDistributionConfigInput) (*request.Request, *cloudfront.GetStreamingDistributionConfigOutput)
GetStreamingDistributionConfig(*cloudfront.GetStreamingDistributionConfigInput) (*cloudfront.GetStreamingDistributionConfigOutput, error)
ListCloudFrontOriginAccessIdentitiesRequest(*cloudfront.ListCloudFrontOriginAccessIdentitiesInput) (*request.Request, *cloudfront.ListCloudFrontOriginAccessIdentitiesOutput)
ListCloudFrontOriginAccessIdentities(*cloudfront.ListCloudFrontOriginAccessIdentitiesInput) (*cloudfront.ListCloudFrontOriginAccessIdentitiesOutput, error)
ListCloudFrontOriginAccessIdentitiesPages(*cloudfront.ListCloudFrontOriginAccessIdentitiesInput, func(*cloudfront.ListCloudFrontOriginAccessIdentitiesOutput, bool) bool) error
ListDistributionsRequest(*cloudfront.ListDistributionsInput) (*request.Request, *cloudfront.ListDistributionsOutput)
ListDistributions(*cloudfront.ListDistributionsInput) (*cloudfront.ListDistributionsOutput, error)
ListDistributionsPages(*cloudfront.ListDistributionsInput, func(*cloudfront.ListDistributionsOutput, bool) bool) error
ListDistributionsByWebACLIdRequest(*cloudfront.ListDistributionsByWebACLIdInput) (*request.Request, *cloudfront.ListDistributionsByWebACLIdOutput)
ListDistributionsByWebACLId(*cloudfront.ListDistributionsByWebACLIdInput) (*cloudfront.ListDistributionsByWebACLIdOutput, error)
ListInvalidationsRequest(*cloudfront.ListInvalidationsInput) (*request.Request, *cloudfront.ListInvalidationsOutput)
ListInvalidations(*cloudfront.ListInvalidationsInput) (*cloudfront.ListInvalidationsOutput, error)
ListInvalidationsPages(*cloudfront.ListInvalidationsInput, func(*cloudfront.ListInvalidationsOutput, bool) bool) error
ListStreamingDistributionsRequest(*cloudfront.ListStreamingDistributionsInput) (*request.Request, *cloudfront.ListStreamingDistributionsOutput)
ListStreamingDistributions(*cloudfront.ListStreamingDistributionsInput) (*cloudfront.ListStreamingDistributionsOutput, error)
ListStreamingDistributionsPages(*cloudfront.ListStreamingDistributionsInput, func(*cloudfront.ListStreamingDistributionsOutput, bool) bool) error
UpdateCloudFrontOriginAccessIdentityRequest(*cloudfront.UpdateCloudFrontOriginAccessIdentityInput) (*request.Request, *cloudfront.UpdateCloudFrontOriginAccessIdentityOutput)
UpdateCloudFrontOriginAccessIdentity(*cloudfront.UpdateCloudFrontOriginAccessIdentityInput) (*cloudfront.UpdateCloudFrontOriginAccessIdentityOutput, error)
UpdateDistributionRequest(*cloudfront.UpdateDistributionInput) (*request.Request, *cloudfront.UpdateDistributionOutput)
UpdateDistribution(*cloudfront.UpdateDistributionInput) (*cloudfront.UpdateDistributionOutput, error)
UpdateStreamingDistributionRequest(*cloudfront.UpdateStreamingDistributionInput) (*request.Request, *cloudfront.UpdateStreamingDistributionOutput)
UpdateStreamingDistribution(*cloudfront.UpdateStreamingDistributionInput) (*cloudfront.UpdateStreamingDistributionOutput, error)
}
var _ CloudFrontAPI = (*cloudfront.CloudFront)(nil)

View File

@@ -1,917 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudfront_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudfront"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(session.New())
params := &cloudfront.CreateCloudFrontOriginAccessIdentityInput{
CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
},
}
resp, err := svc.CreateCloudFrontOriginAccessIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_CreateDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.CreateDistributionInput{
DistributionConfig: &cloudfront.DistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
ForwardedValues: &cloudfront.ForwardedValues{ // Required
Cookies: &cloudfront.CookiePreference{ // Required
Forward: aws.String("ItemSelection"), // Required
WhitelistedNames: &cloudfront.CookieNames{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
QueryString: aws.Bool(true), // Required
Headers: &cloudfront.Headers{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
MinTTL: aws.Int64(1), // Required
TargetOriginId: aws.String("string"), // Required
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
AllowedMethods: &cloudfront.AllowedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
CachedMethods: &cloudfront.CachedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
Compress: aws.Bool(true),
DefaultTTL: aws.Int64(1),
MaxTTL: aws.Int64(1),
SmoothStreaming: aws.Bool(true),
},
Enabled: aws.Bool(true), // Required
Origins: &cloudfront.Origins{ // Required
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.Origin{
{ // Required
DomainName: aws.String("string"), // Required
Id: aws.String("string"), // Required
CustomHeaders: &cloudfront.CustomHeaders{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.OriginCustomHeader{
{ // Required
HeaderName: aws.String("string"), // Required
HeaderValue: aws.String("string"), // Required
},
// More values...
},
},
CustomOriginConfig: &cloudfront.CustomOriginConfig{
HTTPPort: aws.Int64(1), // Required
HTTPSPort: aws.Int64(1), // Required
OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
OriginSslProtocols: &cloudfront.OriginSslProtocols{
Items: []*string{ // Required
aws.String("SslProtocol"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
OriginPath: aws.String("string"),
S3OriginConfig: &cloudfront.S3OriginConfig{
OriginAccessIdentity: aws.String("string"), // Required
},
},
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
CacheBehaviors: &cloudfront.CacheBehaviors{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.CacheBehavior{
{ // Required
ForwardedValues: &cloudfront.ForwardedValues{ // Required
Cookies: &cloudfront.CookiePreference{ // Required
Forward: aws.String("ItemSelection"), // Required
WhitelistedNames: &cloudfront.CookieNames{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
QueryString: aws.Bool(true), // Required
Headers: &cloudfront.Headers{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
MinTTL: aws.Int64(1), // Required
PathPattern: aws.String("string"), // Required
TargetOriginId: aws.String("string"), // Required
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
AllowedMethods: &cloudfront.AllowedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
CachedMethods: &cloudfront.CachedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
Compress: aws.Bool(true),
DefaultTTL: aws.Int64(1),
MaxTTL: aws.Int64(1),
SmoothStreaming: aws.Bool(true),
},
// More values...
},
},
CustomErrorResponses: &cloudfront.CustomErrorResponses{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.CustomErrorResponse{
{ // Required
ErrorCode: aws.Int64(1), // Required
ErrorCachingMinTTL: aws.Int64(1),
ResponseCode: aws.String("string"),
ResponsePagePath: aws.String("string"),
},
// More values...
},
},
DefaultRootObject: aws.String("string"),
Logging: &cloudfront.LoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
IncludeCookies: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
Restrictions: &cloudfront.Restrictions{
GeoRestriction: &cloudfront.GeoRestriction{ // Required
Quantity: aws.Int64(1), // Required
RestrictionType: aws.String("GeoRestrictionType"), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
ViewerCertificate: &cloudfront.ViewerCertificate{
ACMCertificateArn: aws.String("string"),
Certificate: aws.String("string"),
CertificateSource: aws.String("CertificateSource"),
CloudFrontDefaultCertificate: aws.Bool(true),
IAMCertificateId: aws.String("string"),
MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
SSLSupportMethod: aws.String("SSLSupportMethod"),
},
WebACLId: aws.String("string"),
},
}
resp, err := svc.CreateDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_CreateInvalidation() {
svc := cloudfront.New(session.New())
params := &cloudfront.CreateInvalidationInput{
DistributionId: aws.String("string"), // Required
InvalidationBatch: &cloudfront.InvalidationBatch{ // Required
CallerReference: aws.String("string"), // Required
Paths: &cloudfront.Paths{ // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
}
resp, err := svc.CreateInvalidation(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_CreateStreamingDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.CreateStreamingDistributionInput{
StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
S3Origin: &cloudfront.S3Origin{ // Required
DomainName: aws.String("string"), // Required
OriginAccessIdentity: aws.String("string"), // Required
},
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Logging: &cloudfront.StreamingLoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
},
}
resp, err := svc.CreateStreamingDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_DeleteCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(session.New())
params := &cloudfront.DeleteCloudFrontOriginAccessIdentityInput{
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.DeleteCloudFrontOriginAccessIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_DeleteDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.DeleteDistributionInput{
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.DeleteDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_DeleteStreamingDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.DeleteStreamingDistributionInput{
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.DeleteStreamingDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetCloudFrontOriginAccessIdentityInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetCloudFrontOriginAccessIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetCloudFrontOriginAccessIdentityConfig() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetCloudFrontOriginAccessIdentityConfigInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetCloudFrontOriginAccessIdentityConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetDistributionInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetDistributionConfig() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetDistributionConfigInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetDistributionConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetInvalidation() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetInvalidationInput{
DistributionId: aws.String("string"), // Required
Id: aws.String("string"), // Required
}
resp, err := svc.GetInvalidation(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetStreamingDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetStreamingDistributionInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetStreamingDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_GetStreamingDistributionConfig() {
svc := cloudfront.New(session.New())
params := &cloudfront.GetStreamingDistributionConfigInput{
Id: aws.String("string"), // Required
}
resp, err := svc.GetStreamingDistributionConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_ListCloudFrontOriginAccessIdentities() {
svc := cloudfront.New(session.New())
params := &cloudfront.ListCloudFrontOriginAccessIdentitiesInput{
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListCloudFrontOriginAccessIdentities(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_ListDistributions() {
svc := cloudfront.New(session.New())
params := &cloudfront.ListDistributionsInput{
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListDistributions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_ListDistributionsByWebACLId() {
svc := cloudfront.New(session.New())
params := &cloudfront.ListDistributionsByWebACLIdInput{
WebACLId: aws.String("string"), // Required
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListDistributionsByWebACLId(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_ListInvalidations() {
svc := cloudfront.New(session.New())
params := &cloudfront.ListInvalidationsInput{
DistributionId: aws.String("string"), // Required
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListInvalidations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_ListStreamingDistributions() {
svc := cloudfront.New(session.New())
params := &cloudfront.ListStreamingDistributionsInput{
Marker: aws.String("string"),
MaxItems: aws.Int64(1),
}
resp, err := svc.ListStreamingDistributions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() {
svc := cloudfront.New(session.New())
params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{
CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
},
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateCloudFrontOriginAccessIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_UpdateDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.UpdateDistributionInput{
DistributionConfig: &cloudfront.DistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
ForwardedValues: &cloudfront.ForwardedValues{ // Required
Cookies: &cloudfront.CookiePreference{ // Required
Forward: aws.String("ItemSelection"), // Required
WhitelistedNames: &cloudfront.CookieNames{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
QueryString: aws.Bool(true), // Required
Headers: &cloudfront.Headers{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
MinTTL: aws.Int64(1), // Required
TargetOriginId: aws.String("string"), // Required
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
AllowedMethods: &cloudfront.AllowedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
CachedMethods: &cloudfront.CachedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
Compress: aws.Bool(true),
DefaultTTL: aws.Int64(1),
MaxTTL: aws.Int64(1),
SmoothStreaming: aws.Bool(true),
},
Enabled: aws.Bool(true), // Required
Origins: &cloudfront.Origins{ // Required
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.Origin{
{ // Required
DomainName: aws.String("string"), // Required
Id: aws.String("string"), // Required
CustomHeaders: &cloudfront.CustomHeaders{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.OriginCustomHeader{
{ // Required
HeaderName: aws.String("string"), // Required
HeaderValue: aws.String("string"), // Required
},
// More values...
},
},
CustomOriginConfig: &cloudfront.CustomOriginConfig{
HTTPPort: aws.Int64(1), // Required
HTTPSPort: aws.Int64(1), // Required
OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
OriginSslProtocols: &cloudfront.OriginSslProtocols{
Items: []*string{ // Required
aws.String("SslProtocol"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
OriginPath: aws.String("string"),
S3OriginConfig: &cloudfront.S3OriginConfig{
OriginAccessIdentity: aws.String("string"), // Required
},
},
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
CacheBehaviors: &cloudfront.CacheBehaviors{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.CacheBehavior{
{ // Required
ForwardedValues: &cloudfront.ForwardedValues{ // Required
Cookies: &cloudfront.CookiePreference{ // Required
Forward: aws.String("ItemSelection"), // Required
WhitelistedNames: &cloudfront.CookieNames{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
QueryString: aws.Bool(true), // Required
Headers: &cloudfront.Headers{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
MinTTL: aws.Int64(1), // Required
PathPattern: aws.String("string"), // Required
TargetOriginId: aws.String("string"), // Required
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
AllowedMethods: &cloudfront.AllowedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
CachedMethods: &cloudfront.CachedMethods{
Items: []*string{ // Required
aws.String("Method"), // Required
// More values...
},
Quantity: aws.Int64(1), // Required
},
},
Compress: aws.Bool(true),
DefaultTTL: aws.Int64(1),
MaxTTL: aws.Int64(1),
SmoothStreaming: aws.Bool(true),
},
// More values...
},
},
CustomErrorResponses: &cloudfront.CustomErrorResponses{
Quantity: aws.Int64(1), // Required
Items: []*cloudfront.CustomErrorResponse{
{ // Required
ErrorCode: aws.Int64(1), // Required
ErrorCachingMinTTL: aws.Int64(1),
ResponseCode: aws.String("string"),
ResponsePagePath: aws.String("string"),
},
// More values...
},
},
DefaultRootObject: aws.String("string"),
Logging: &cloudfront.LoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
IncludeCookies: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
Restrictions: &cloudfront.Restrictions{
GeoRestriction: &cloudfront.GeoRestriction{ // Required
Quantity: aws.Int64(1), // Required
RestrictionType: aws.String("GeoRestrictionType"), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
},
ViewerCertificate: &cloudfront.ViewerCertificate{
ACMCertificateArn: aws.String("string"),
Certificate: aws.String("string"),
CertificateSource: aws.String("CertificateSource"),
CloudFrontDefaultCertificate: aws.Bool(true),
IAMCertificateId: aws.String("string"),
MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
SSLSupportMethod: aws.String("SSLSupportMethod"),
},
WebACLId: aws.String("string"),
},
Id: aws.String("string"), // Required
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudFront_UpdateStreamingDistribution() {
svc := cloudfront.New(session.New())
params := &cloudfront.UpdateStreamingDistributionInput{
Id: aws.String("string"), // Required
StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
CallerReference: aws.String("string"), // Required
Comment: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
S3Origin: &cloudfront.S3Origin{ // Required
DomainName: aws.String("string"), // Required
OriginAccessIdentity: aws.String("string"), // Required
},
TrustedSigners: &cloudfront.TrustedSigners{ // Required
Enabled: aws.Bool(true), // Required
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Aliases: &cloudfront.Aliases{
Quantity: aws.Int64(1), // Required
Items: []*string{
aws.String("string"), // Required
// More values...
},
},
Logging: &cloudfront.StreamingLoggingConfig{
Bucket: aws.String("string"), // Required
Enabled: aws.Bool(true), // Required
Prefix: aws.String("string"), // Required
},
PriceClass: aws.String("PriceClass"),
},
IfMatch: aws.String("string"),
}
resp, err := svc.UpdateStreamingDistribution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,86 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudfront
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restxml"
)
// CloudFront is a client for CloudFront.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudFront struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cloudfront"
// New creates a new instance of the CloudFront client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudFront client from just a session.
// svc := cloudfront.New(mySession)
//
// // Create a CloudFront client with additional configuration
// svc := cloudfront.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudFront {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudFront {
svc := &CloudFront{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-01-28",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudFront operation and runs any
// custom request initialization.
func (c *CloudFront) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View File

@@ -1,226 +0,0 @@
package sign
import (
"bytes"
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/url"
"strings"
"time"
"unicode"
)
// An AWSEpochTime wraps a time value providing JSON serialization needed for
// AWS Policy epoch time fields.
type AWSEpochTime struct {
time.Time
}
// NewAWSEpochTime returns a new AWSEpochTime pointer wrapping the Go time provided.
func NewAWSEpochTime(t time.Time) *AWSEpochTime {
return &AWSEpochTime{t}
}
// MarshalJSON serializes the epoch time as AWS Profile epoch time.
func (t AWSEpochTime) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`{"AWS:EpochTime":%d}`, t.UTC().Unix())), nil
}
// An IPAddress wraps an IPAddress source IP providing JSON serialization information
type IPAddress struct {
SourceIP string `json:"AWS:SourceIp"`
}
// A Condition defines the restrictions for how a signed URL can be used.
type Condition struct {
// Optional IP address mask the signed URL must be requested from.
IPAddress *IPAddress `json:"IpAddress,omitempty"`
// Optional date that the signed URL cannot be used until. It is invalid
// to make requests with the signed URL prior to this date.
DateGreaterThan *AWSEpochTime `json:",omitempty"`
// Required date that the signed URL will expire. A DateLessThan is required
// sign cloud front URLs
DateLessThan *AWSEpochTime `json:",omitempty"`
}
// A Statement is a collection of conditions for resources
type Statement struct {
// The Web or RTMP resource the URL will be signed for
Resource string
// The set of conditions for this resource
Condition Condition
}
// A Policy defines the resources that a signed will be signed for.
//
// See the following page for more information on how policies are constructed.
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html#private-content-custom-policy-statement
type Policy struct {
// List of resource and condition statements.
// Signed URLs should only provide a single statement.
Statements []Statement `json:"Statement"`
}
// Override for testing to mock out usage of crypto/rand.Reader
var randReader = rand.Reader
// Sign will sign a policy using an RSA private key. It will return a base 64
// encoded signature and policy if no error is encountered.
//
// The signature and policy should be added to the signed URL following the
// guidelines in:
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html
func (p *Policy) Sign(privKey *rsa.PrivateKey) (b64Signature, b64Policy []byte, err error) {
if err = p.Validate(); err != nil {
return nil, nil, err
}
// Build and escape the policy
b64Policy, jsonPolicy, err := encodePolicy(p)
if err != nil {
return nil, nil, err
}
awsEscapeEncoded(b64Policy)
// Build and escape the signature
b64Signature, err = signEncodedPolicy(randReader, jsonPolicy, privKey)
if err != nil {
return nil, nil, err
}
awsEscapeEncoded(b64Signature)
return b64Signature, b64Policy, nil
}
// Validate verifies that the policy is valid and usable, and returns an
// error if there is a problem.
func (p *Policy) Validate() error {
if len(p.Statements) == 0 {
return fmt.Errorf("at least one policy statement is required")
}
for i, s := range p.Statements {
if s.Resource == "" {
return fmt.Errorf("statement at index %d does not have a resource", i)
}
if !isASCII(s.Resource) {
return fmt.Errorf("unable to sign resource, [%s]. "+
"Resources must only contain ascii characters. "+
"Hostnames with unicode should be encoded as Punycode, (e.g. golang.org/x/net/idna), "+
"and URL unicode path/query characters should be escaped.", s.Resource)
}
}
return nil
}
// CreateResource constructs, validates, and returns a resource URL string. An
// error will be returned if unable to create the resource string.
func CreateResource(scheme, u string) (string, error) {
scheme = strings.ToLower(scheme)
if scheme == "http" || scheme == "https" || scheme == "http*" || scheme == "*" {
return u, nil
}
if scheme == "rtmp" {
parsed, err := url.Parse(u)
if err != nil {
return "", fmt.Errorf("unable to parse rtmp URL, err: %s", err)
}
rtmpURL := strings.TrimLeft(parsed.Path, "/")
if parsed.RawQuery != "" {
rtmpURL = fmt.Sprintf("%s?%s", rtmpURL, parsed.RawQuery)
}
return rtmpURL, nil
}
return "", fmt.Errorf("invalid URL scheme must be http, https, or rtmp. Provided: %s", scheme)
}
// NewCannedPolicy returns a new Canned Policy constructed using the resource
// and expires time. This can be used to generate the basic model for a Policy
// that can be then augmented with additional conditions.
//
// See the following page for more information on how policies are constructed.
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html#private-content-custom-policy-statement
func NewCannedPolicy(resource string, expires time.Time) *Policy {
return &Policy{
Statements: []Statement{
{
Resource: resource,
Condition: Condition{
DateLessThan: NewAWSEpochTime(expires),
},
},
},
}
}
// encodePolicy encodes the Policy as JSON and also base 64 encodes it.
func encodePolicy(p *Policy) (b64Policy, jsonPolicy []byte, err error) {
jsonPolicy, err = json.Marshal(p)
if err != nil {
return nil, nil, fmt.Errorf("failed to encode policy, %s", err.Error())
}
// Remove leading and trailing white space, JSON encoding will note include
// whitespace within the encoding.
jsonPolicy = bytes.TrimSpace(jsonPolicy)
b64Policy = make([]byte, base64.StdEncoding.EncodedLen(len(jsonPolicy)))
base64.StdEncoding.Encode(b64Policy, jsonPolicy)
return b64Policy, jsonPolicy, nil
}
// signEncodedPolicy will sign and base 64 encode the JSON encoded policy.
func signEncodedPolicy(randReader io.Reader, jsonPolicy []byte, privKey *rsa.PrivateKey) ([]byte, error) {
hash := sha1.New()
if _, err := bytes.NewReader(jsonPolicy).WriteTo(hash); err != nil {
return nil, fmt.Errorf("failed to calculate signing hash, %s", err.Error())
}
sig, err := rsa.SignPKCS1v15(randReader, privKey, crypto.SHA1, hash.Sum(nil))
if err != nil {
return nil, fmt.Errorf("failed to sign policy, %s", err.Error())
}
b64Sig := make([]byte, base64.StdEncoding.EncodedLen(len(sig)))
base64.StdEncoding.Encode(b64Sig, sig)
return b64Sig, nil
}
// special characters to be replaced with awsEscapeEncoded
var invalidEncodedChar = map[byte]byte{
'+': '-',
'=': '_',
'/': '~',
}
// awsEscapeEncoded will replace base64 encoding's special characters to be URL safe.
func awsEscapeEncoded(b []byte) {
for i, v := range b {
if r, ok := invalidEncodedChar[v]; ok {
b[i] = r
}
}
}
func isASCII(u string) bool {
for _, c := range u {
if c > unicode.MaxASCII {
return false
}
}
return true
}

View File

@@ -1,139 +0,0 @@
package sign
import (
"bytes"
"crypto"
"crypto/rsa"
"crypto/sha1"
"encoding/base64"
"fmt"
"math/rand"
"strings"
"testing"
"time"
)
func TestEpochTimeMarshal(t *testing.T) {
v := AWSEpochTime{time.Now()}
b, err := v.MarshalJSON()
if err != nil {
t.Fatalf("Unexpected error, %#v", err)
}
expected := fmt.Sprintf(`{"AWS:EpochTime":%d}`, v.UTC().Unix())
if string(b) != expected {
t.Errorf("Expected marshaled time to match, expect: %s, actual: %s",
expected, string(b))
}
}
var testCreateResource = []struct {
scheme, u string
expect string
errPrefix string
}{
{
"https", "https://example.com/a?b=1",
"https://example.com/a?b=1", "",
},
{
"http", "http*://example.com/a?b=1",
"http*://example.com/a?b=1", "",
},
{
"rtmp", "https://example.com/a?b=1",
"a?b=1", "",
},
{
"ftp", "ftp://example.com/a?b=1",
"", "invalid URL scheme",
},
}
func TestCreateResource(t *testing.T) {
for i, v := range testCreateResource {
r, err := CreateResource(v.scheme, v.u)
if err != nil {
if v.errPrefix == "" {
t.Errorf("%d, Unexpected error %s", i, err.Error())
continue
}
if !strings.HasPrefix(err.Error(), v.errPrefix) {
t.Errorf("%d, Expected to find prefix\nexpect: %s\nactual: %s", i, v.errPrefix, err.Error())
continue
}
} else if v.errPrefix != "" {
t.Errorf("%d, Expected error %s", i, v.errPrefix)
continue
}
if v.expect != r {
t.Errorf("%d, Expected to find prefix\nexpect: %s\nactual: %s", i, v.expect, r)
}
}
}
var testTime = time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
const expectedJSONPolicy = `{"Statement":[{"Resource":"https://example.com/a","Condition":{"DateLessThan":{"AWS:EpochTime":1257894000}}}]}`
const expectedB64Policy = `eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9hIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxMjU3ODk0MDAwfX19XX0=`
func TestEncodePolicy(t *testing.T) {
p := NewCannedPolicy("https://example.com/a", testTime)
b64Policy, jsonPolicy, err := encodePolicy(p)
if err != nil {
t.Fatalf("Unexpected error, %#v", err)
}
if string(jsonPolicy) != expectedJSONPolicy {
t.Errorf("Expected json encoding to match, \nexpect: %s\nactual: %s\n", expectedJSONPolicy, jsonPolicy)
}
if string(b64Policy) != expectedB64Policy {
t.Errorf("Expected b64 encoding to match, \nexpect: %s\nactual: %s\n", expectedB64Policy, b64Policy)
}
}
func TestSignEncodedPolicy(t *testing.T) {
p := NewCannedPolicy("https://example.com/a", testTime)
_, jsonPolicy, err := encodePolicy(p)
if err != nil {
t.Fatalf("Unexpected policy encode error, %#v", err)
}
r := newRandomReader(rand.New(rand.NewSource(1)))
privKey, err := rsa.GenerateKey(r, 1024)
if err != nil {
t.Fatalf("Unexpected priv key error, %#v", err)
}
b64Signature, err := signEncodedPolicy(r, jsonPolicy, privKey)
if err != nil {
t.Fatalf("Unexpected policy sign error, %#v", err)
}
hash := sha1.New()
if _, err = bytes.NewReader(jsonPolicy).WriteTo(hash); err != nil {
t.Fatalf("Unexpected hash error, %#v", err)
}
decodedSig, err := base64.StdEncoding.DecodeString(string(b64Signature))
if err != nil {
t.Fatalf("Unexpected base64 decode signature, %#v", err)
}
if err := rsa.VerifyPKCS1v15(&privKey.PublicKey, crypto.SHA1, hash.Sum(nil), decodedSig); err != nil {
t.Fatalf("Unable to verify signature, %#v", err)
}
}
func TestAWSEscape(t *testing.T) {
expect := "a-b_c~"
actual := []byte("a+b=c/")
awsEscapeEncoded(actual)
if string(actual) != expect {
t.Errorf("expect: %s, actual: %s", expect, string(actual))
}
}

View File

@@ -1,68 +0,0 @@
package sign
import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"io"
"io/ioutil"
"os"
)
// LoadPEMPrivKeyFile reads a PEM encoded RSA private key from the file name.
// A new RSA private key will be returned if no error.
func LoadPEMPrivKeyFile(name string) (*rsa.PrivateKey, error) {
file, err := os.Open(name)
if err != nil {
return nil, err
}
defer file.Close()
return LoadPEMPrivKey(file)
}
// LoadPEMPrivKey reads a PEM encoded RSA private key from the io.Reader.
// A new RSA private key will be returned if no error.
func LoadPEMPrivKey(reader io.Reader) (*rsa.PrivateKey, error) {
block, err := loadPem(reader)
if err != nil {
return nil, err
}
return x509.ParsePKCS1PrivateKey(block.Bytes)
}
// LoadEncryptedPEMPrivKey decrypts the PEM encoded private key using the
// password provided returning a RSA private key. If the PEM data is invalid,
// or unable to decrypt an error will be returned.
func LoadEncryptedPEMPrivKey(reader io.Reader, password []byte) (*rsa.PrivateKey, error) {
block, err := loadPem(reader)
if err != nil {
return nil, err
}
decryptedBlock, err := x509.DecryptPEMBlock(block, password)
if err != nil {
return nil, err
}
return x509.ParsePKCS1PrivateKey(decryptedBlock)
}
func loadPem(reader io.Reader) (*pem.Block, error) {
b, err := ioutil.ReadAll(reader)
if err != nil {
return nil, err
}
block, _ := pem.Decode(b)
if block == nil {
// pem.Decode will set block to nil if there is no PEM data in the input
// the second parameter will contain the provided bytes that failed
// to be decoded.
return nil, fmt.Errorf("no valid PEM data provided")
}
return block, nil
}

View File

@@ -1,90 +0,0 @@
package sign
import (
"bytes"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"io"
"math/rand"
"strings"
"testing"
)
func generatePEM(randReader io.Reader, password []byte) (buf *bytes.Buffer, err error) {
k, err := rsa.GenerateKey(randReader, 1024)
if err != nil {
return nil, err
}
derBytes := x509.MarshalPKCS1PrivateKey(k)
var block *pem.Block
if password != nil {
block, err = x509.EncryptPEMBlock(randReader, "RSA PRIVATE KEY", derBytes, password, x509.PEMCipherAES128)
} else {
block = &pem.Block{
Type: "RSA PRIVATE KEY",
Bytes: derBytes,
}
}
buf = &bytes.Buffer{}
err = pem.Encode(buf, block)
return buf, err
}
func TestLoadPemPrivKey(t *testing.T) {
reader, err := generatePEM(newRandomReader(rand.New(rand.NewSource(1))), nil)
if err != nil {
t.Errorf("Unexpected pem generation err %s", err.Error())
}
privKey, err := LoadPEMPrivKey(reader)
if err != nil {
t.Errorf("Unexpected key load error, %s", err.Error())
}
if privKey == nil {
t.Errorf("Expected valid privKey, but got nil")
}
}
func TestLoadPemPrivKeyInvalidPEM(t *testing.T) {
reader := strings.NewReader("invalid PEM data")
privKey, err := LoadPEMPrivKey(reader)
if err == nil {
t.Errorf("Expected error invalid PEM data error")
}
if privKey != nil {
t.Errorf("Expected nil privKey but got %#v", privKey)
}
}
func TestLoadEncryptedPEMPrivKey(t *testing.T) {
reader, err := generatePEM(newRandomReader(rand.New(rand.NewSource(1))), []byte("password"))
if err != nil {
t.Errorf("Unexpected pem generation err %s", err.Error())
}
privKey, err := LoadEncryptedPEMPrivKey(reader, []byte("password"))
if err != nil {
t.Errorf("Unexpected key load error, %s", err.Error())
}
if privKey == nil {
t.Errorf("Expected valid privKey, but got nil")
}
}
func TestLoadEncryptedPEMPrivKeyWrongPassword(t *testing.T) {
reader, err := generatePEM(newRandomReader(rand.New(rand.NewSource(1))), []byte("password"))
privKey, err := LoadEncryptedPEMPrivKey(reader, []byte("wrong password"))
if err == nil {
t.Errorf("Expected error invalid PEM data error")
}
if privKey != nil {
t.Errorf("Expected nil privKey but got %#v", privKey)
}
}

View File

@@ -1,30 +0,0 @@
package sign
import (
"bytes"
"encoding/binary"
"math/rand"
)
// A randomReader wraps a math/rand.Rand within an reader so that it can used
// as a predictable testing replacement for crypto/rand.Reader
type randomReader struct {
b *bytes.Buffer
r *rand.Rand
}
// newRandomReader returns a new instance of the random reader
func newRandomReader(r *rand.Rand) *randomReader {
return &randomReader{b: &bytes.Buffer{}, r: r}
}
// Read will read random bytes from up to the length of b.
func (m *randomReader) Read(b []byte) (int, error) {
for i := 0; i < len(b); {
binary.Write(m.b, binary.LittleEndian, m.r.Int63())
n, _ := m.b.Read(b[i:])
i += n
}
return len(b), nil
}

View File

@@ -1,241 +0,0 @@
package sign
import (
"crypto/rsa"
"fmt"
"net/http"
"strings"
"time"
)
const (
// CookiePolicyName name of the policy cookie
CookiePolicyName = "CloudFront-Policy"
// CookieSignatureName name of the signature cookie
CookieSignatureName = "CloudFront-Signature"
// CookieKeyIDName name of the signing Key ID cookie
CookieKeyIDName = "CloudFront-Key-Pair-Id"
)
// A CookieOptions optional additonal options that can be applied to the signed
// cookies.
type CookieOptions struct {
Path string
Domain string
Secure bool
}
// apply will integration the options provided into the base cookie options
// a new copy will be returned. The base CookieOption will not be modified.
func (o CookieOptions) apply(opts ...func(*CookieOptions)) CookieOptions {
if len(opts) == 0 {
return o
}
for _, opt := range opts {
opt(&o)
}
return o
}
// A CookieSigner provides signing utilities to sign Cookies for Amazon CloudFront
// resources. Using a private key and Credential Key Pair key ID the CookieSigner
// only needs to be created once per Credential Key Pair key ID and private key.
//
// More information about signed Cookies and their structure can be found at:
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-setting-signed-cookie-custom-policy.html
//
// To sign a Cookie, create a CookieSigner with your private key and credential
// pair key ID. Once you have a CookieSigner instance you can call Sign or
// SignWithPolicy to sign the URLs.
//
// The signer is safe to use concurrently, but the optional cookies options
// are not safe to modify concurrently.
type CookieSigner struct {
keyID string
privKey *rsa.PrivateKey
Opts CookieOptions
}
// NewCookieSigner constructs and returns a new CookieSigner to be used to for
// signing Amazon CloudFront URL resources with.
func NewCookieSigner(keyID string, privKey *rsa.PrivateKey, opts ...func(*CookieOptions)) *CookieSigner {
signer := &CookieSigner{
keyID: keyID,
privKey: privKey,
Opts: CookieOptions{}.apply(opts...),
}
return signer
}
// Sign returns the cookies needed to allow user agents to make arbetrary
// requests to cloudfront for the resource(s) defined by the policy.
//
// Sign will create a CloudFront policy with only a resource and condition of
// DateLessThan equal to the expires time provided.
//
// The returned slice cookies should all be added to the Client's cookies or
// server's response.
//
// Example:
// s := NewCookieSigner(keyID, privKey)
//
// // Get Signed cookies for a resource that will expire in 1 hour
// cookies, err := s.Sign("*", time.Now().Add(1 * time.Hour))
// if err != nil {
// fmt.Println("failed to create signed cookies", err)
// return
// }
//
// // Or get Signed cookies for a resource that will expire in 1 hour
// // and set path and domain of cookies
// cookies, err := s.Sign("*", time.Now().Add(1 * time.Hour), func(o *sign.CookieOptions) {
// o.Path = "/"
// o.Domain = ".example.com"
// })
// if err != nil {
// fmt.Println("failed to create signed cookies", err)
// return
// }
//
// // Server Response via http.ResponseWriter
// for _, c := range cookies {
// http.SetCookie(w, c)
// }
//
// // Client request via the cookie jar
// if client.CookieJar != nil {
// for _, c := range cookies {
// client.Cookie(w, c)
// }
// }
func (s CookieSigner) Sign(u string, expires time.Time, opts ...func(*CookieOptions)) ([]*http.Cookie, error) {
scheme, err := cookieURLScheme(u)
if err != nil {
return nil, err
}
resource, err := CreateResource(scheme, u)
if err != nil {
return nil, err
}
p := NewCannedPolicy(resource, expires)
return createCookies(p, s.keyID, s.privKey, s.Opts.apply(opts...))
}
// Returns and validates the URL's scheme.
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-setting-signed-cookie-custom-policy.html#private-content-custom-policy-statement-cookies
func cookieURLScheme(u string) (string, error) {
parts := strings.SplitN(u, "://", 2)
if len(parts) != 2 {
return "", fmt.Errorf("invalid cookie URL, missing scheme")
}
scheme := strings.ToLower(parts[0])
if scheme != "http" && scheme != "https" && scheme != "http*" {
return "", fmt.Errorf("invalid cookie URL scheme. Expect http, https, or http*. Go, %s", scheme)
}
return scheme, nil
}
// SignWithPolicy returns the cookies needed to allow user agents to make
// arbetrairy requets to cloudfront for the resource(s) defined by the policy.
//
// The returned slice cookies should all be added to the Client's cookies or
// server's response.
//
// Example:
// s := NewCookieSigner(keyID, privKey)
//
// policy := &sign.Policy{
// Statements: []sign.Statement{
// {
// // Read the provided documentation on how to set this
// // correctly, you'll probably want to use wildcards.
// Resource: RawCloudFrontURL,
// Condition: sign.Condition{
// // Optional IP source address range
// IPAddress: &sign.IPAddress{SourceIP: "192.0.2.0/24"},
// // Optional date URL is not valid until
// DateGreaterThan: &sign.AWSEpochTime{time.Now().Add(30 * time.Minute)},
// // Required date the URL will expire after
// DateLessThan: &sign.AWSEpochTime{time.Now().Add(1 * time.Hour)},
// },
// },
// },
// }
//
// // Get Signed cookies for a resource that will expire in 1 hour
// cookies, err := s.SignWithPolicy(policy)
// if err != nil {
// fmt.Println("failed to create signed cookies", err)
// return
// }
//
// // Or get Signed cookies for a resource that will expire in 1 hour
// // and set path and domain of cookies
// cookies, err := s.Sign(policy, func(o *sign.CookieOptions) {
// o.Path = "/"
// o.Domain = ".example.com"
// })
// if err != nil {
// fmt.Println("failed to create signed cookies", err)
// return
// }
//
// // Server Response via http.ResponseWriter
// for _, c := range cookies {
// http.SetCookie(w, c)
// }
//
// // Client request via the cookie jar
// if client.CookieJar != nil {
// for _, c := range cookies {
// client.Cookie(w, c)
// }
// }
func (s CookieSigner) SignWithPolicy(p *Policy, opts ...func(*CookieOptions)) ([]*http.Cookie, error) {
return createCookies(p, s.keyID, s.privKey, s.Opts.apply(opts...))
}
// Prepares the cookies to be attached to the header. An (optional) options
// struct is provided in case people don't want to manually edit their cookies.
func createCookies(p *Policy, keyID string, privKey *rsa.PrivateKey, opt CookieOptions) ([]*http.Cookie, error) {
b64Sig, b64Policy, err := p.Sign(privKey)
if err != nil {
return nil, err
}
// Creates proper cookies
cPolicy := &http.Cookie{
Name: CookiePolicyName,
Value: string(b64Policy),
HttpOnly: true,
}
cSignature := &http.Cookie{
Name: CookieSignatureName,
Value: string(b64Sig),
HttpOnly: true,
}
cKey := &http.Cookie{
Name: CookieKeyIDName,
Value: keyID,
HttpOnly: true,
}
cookies := []*http.Cookie{cPolicy, cSignature, cKey}
// Applie the cookie options
for _, c := range cookies {
c.Path = opt.Path
c.Domain = opt.Domain
c.Secure = opt.Secure
}
return cookies, nil
}

View File

@@ -1,163 +0,0 @@
package sign
import (
"fmt"
"io"
"math/rand"
"net/http"
"time"
)
func examplePEMReader() io.Reader {
reader, err := generatePEM(randReader, nil)
if err != nil {
panic(fmt.Sprintf("Unexpected pem generation err %v", err))
}
return reader
}
func ExampleCookieSigner_Sign() {
origRandReader := randReader
randReader = newRandomReader(rand.New(rand.NewSource(1)))
defer func() {
randReader = origRandReader
}()
// Load your private key so it can be used by the CookieSigner
// To load private key from file use `sign.LoadPEMPrivKeyFile`.
privKey, err := LoadPEMPrivKey(examplePEMReader())
if err != nil {
fmt.Println("failed to load private key", err)
return
}
cookieSigner := NewCookieSigner("keyID", privKey)
// Use the signer to sign the URL
cookies, err := cookieSigner.Sign("http://example.com/somepath/*", testSignTime.Add(30*time.Minute))
if err != nil {
fmt.Println("failed to sign cookies with policy,", err)
return
}
printExampleCookies(cookies)
// Output:
// Cookies:
// CloudFront-Policy: eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovL2V4YW1wbGUuY29tL3NvbWVwYXRoLyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjEyNTc4OTU4MDB9fX1dfQ__, , , false
// CloudFront-Signature: o~jvj~CFkvGZB~yYED3elicKZag-CRijy8yD2E5yF1s7VNV7kNeQWC7MDtEcBQ8-eh7Xgjh0wMPQdAVdh09gBObd-hXDpKUyh8YKxogj~oloV~8KOvqE5xzWiKcqjdfJjmT5iEqIui~H1ExYjyKjgir79npmlyYkaJS5s62EQa8_, , , false
// CloudFront-Key-Pair-Id: keyID, , , false
}
func ExampleCookieSigner_SignWithPolicy() {
origRandReader := randReader
randReader = newRandomReader(rand.New(rand.NewSource(1)))
defer func() {
randReader = origRandReader
}()
// Sign cookie to be valid for 30 minutes from now, expires one hour
// from now, and restricted to the 192.0.2.0/24 IP address range.
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-setting-signed-cookie-custom-policy.html
p := &Policy{
// Only a single policy statement can be used with CloudFront
// cookie signatures.
Statements: []Statement{{
// Read the provided documentation on how to set this correctly,
// you'll probably want to use wildcards
Resource: "http://sub.cloudfront.com",
Condition: Condition{
// Optional IP source address range
IPAddress: &IPAddress{SourceIP: "192.0.2.0/24"},
// Optional date URL is not valid until
DateGreaterThan: &AWSEpochTime{testSignTime.Add(30 * time.Minute)},
// Required date the URL will expire after
DateLessThan: &AWSEpochTime{testSignTime.Add(1 * time.Hour)},
},
},
},
}
// Load your private key so it can be used by the CookieSigner
// To load private key from file use `sign.LoadPEMPrivKeyFile`.
privKey, err := LoadPEMPrivKey(examplePEMReader())
if err != nil {
fmt.Println("failed to load private key", err)
return
}
// Key ID that represents the key pair associated with the private key
keyID := "privateKeyID"
// Set credentials to the CookieSigner.
cookieSigner := NewCookieSigner(keyID, privKey)
// Avoid adding an Expire or MaxAge. See provided AWS Documentation for
// more info.
cookies, err := cookieSigner.SignWithPolicy(p)
if err != nil {
fmt.Println("failed to sign cookies with policy,", err)
return
}
printExampleCookies(cookies)
// Output:
// Cookies:
// CloudFront-Policy: eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovL3N1Yi5jbG91ZGZyb250LmNvbSIsIkNvbmRpdGlvbiI6eyJJcEFkZHJlc3MiOnsiQVdTOlNvdXJjZUlwIjoiMTkyLjAuMi4wLzI0In0sIkRhdGVHcmVhdGVyVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxMjU3ODk1ODAwfSwiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjEyNTc4OTc2MDB9fX1dfQ__, , , false
// CloudFront-Signature: JaWdcbr98colrDAhOpkyxqCZev2IAxURu1RKKo1wS~sI5XdNXWYbZJs2FdpbJ475ZvmhZ1-r4ENUqBXAlRfPfOc21Hm4~24jRmPTO3512D4uuJHrPVxSfgeGuFeigfCGWAqyfYYH1DsFl5JQDpzetsNI3ZhGRkQb8V-oYFanddg_, , , false
// CloudFront-Key-Pair-Id: privateKeyID, , , false
}
func ExampleCookieSigner_SignOptions() {
origRandReader := randReader
randReader = newRandomReader(rand.New(rand.NewSource(1)))
defer func() {
randReader = origRandReader
}()
// Load your private key so it can be used by the CookieSigner
// To load private key from file use `sign.LoadPEMPrivKeyFile`.
privKey, err := LoadPEMPrivKey(examplePEMReader())
if err != nil {
fmt.Println("failed to load private key", err)
return
}
// Create the CookieSigner with options set. These options can be set
// directly with cookieSigner.Opts. These values can be overriden on
// individual Sign and SignWithProfile calls.
cookieSigner := NewCookieSigner("keyID", privKey, func(o *CookieOptions) {
//provide an optional struct fields to specify other options
o.Path = "/"
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html
o.Domain = ".cNameAssociatedWithMyDistribution.com"
// Make sure your app/site can handle https payloads, otherwise
// set this to false.
o.Secure = true
})
// Use the signer to sign the URL
cookies, err := cookieSigner.Sign("http*://*", testSignTime.Add(30*time.Minute), func(o *CookieOptions) {
o.Path = "/mypath/"
})
if err != nil {
fmt.Println("failed to sign cookies with policy,", err)
return
}
printExampleCookies(cookies)
// Output:
// Cookies:
// CloudFront-Policy: eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cCo6Ly8qIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxMjU3ODk1ODAwfX19XX0_, /mypath/, .cNameAssociatedWithMyDistribution.com, true
// CloudFront-Signature: Yco06vgowwvSYgTSY9XbXpBcTlUlqpyyYXgRhus3nfnC74A7oQ~fMBH0we-rGxvph8ZyHnTxC5ubbPKSzo3EHUm2IcQeEo4p6WCgZZMzCuLlkpeMKhMAkCqX7rmUfkXhTslBHe~ylcmaZqo-hdnOiWrXk2U974ZQbbt5cOjwQG0_, /mypath/, .cNameAssociatedWithMyDistribution.com, true
// CloudFront-Key-Pair-Id: keyID, /mypath/, .cNameAssociatedWithMyDistribution.com, true
}
func printExampleCookies(cookies []*http.Cookie) {
fmt.Println("Cookies:")
for _, c := range cookies {
fmt.Printf("%s: %s, %s, %s, %t\n", c.Name, c.Value, c.Path, c.Domain, c.Secure)
}
}

View File

@@ -1,83 +0,0 @@
package sign
import (
"crypto/rsa"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestNewCookieSigner(t *testing.T) {
privKey, err := rsa.GenerateKey(randReader, 1024)
if err != nil {
t.Fatalf("Unexpected priv key error, %#v", err)
}
signer := NewCookieSigner("keyID", privKey)
assert.Equal(t, "keyID", signer.keyID)
assert.Equal(t, privKey, signer.privKey)
}
func TestSignCookie(t *testing.T) {
privKey, err := rsa.GenerateKey(randReader, 1024)
assert.NoError(t, err)
signer := NewCookieSigner("keyID", privKey)
cookies, err := signer.Sign("http*://*", time.Now().Add(1*time.Hour))
assert.NoError(t, err)
assert.Equal(t, CookiePolicyName, cookies[0].Name)
assert.Equal(t, CookieSignatureName, cookies[1].Name)
assert.Equal(t, CookieKeyIDName, cookies[2].Name)
}
func TestSignCookie_WithPolicy(t *testing.T) {
privKey, err := rsa.GenerateKey(randReader, 1024)
assert.NoError(t, err)
p := &Policy{
Statements: []Statement{
{
Resource: "*",
Condition: Condition{
DateLessThan: &AWSEpochTime{time.Now().Add(1 * time.Hour)},
},
},
},
}
signer := NewCookieSigner("keyID", privKey)
cookies, err := signer.SignWithPolicy(p)
assert.NoError(t, err)
assert.Equal(t, CookiePolicyName, cookies[0].Name)
assert.Equal(t, CookieSignatureName, cookies[1].Name)
assert.Equal(t, CookieKeyIDName, cookies[2].Name)
}
func TestSignCookie_WithCookieOptions(t *testing.T) {
privKey, err := rsa.GenerateKey(randReader, 1024)
assert.NoError(t, err)
expires := time.Now().Add(1 * time.Hour)
signer := NewCookieSigner("keyID", privKey)
cookies, err := signer.Sign("https://example.com/*", expires, func(o *CookieOptions) {
o.Path = "/"
o.Domain = ".example.com"
o.Secure = true
})
assert.NoError(t, err)
assert.Equal(t, CookiePolicyName, cookies[0].Name)
assert.Equal(t, CookieSignatureName, cookies[1].Name)
assert.Equal(t, CookieKeyIDName, cookies[2].Name)
for _, c := range cookies {
assert.Equal(t, "/", c.Path)
assert.Equal(t, ".example.com", c.Domain)
assert.True(t, c.Secure)
}
}

View File

@@ -1,205 +0,0 @@
// Package sign provides utilities to generate signed URLs for Amazon CloudFront.
//
// More information about signed URLs and their structure can be found at:
// http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-canned-policy.html
//
// To sign a URL create a URLSigner with your private key and credential pair key ID.
// Once you have a URLSigner instance you can call Sign or SignWithPolicy to
// sign the URLs.
//
// Example:
//
// // Sign URL to be valid for 1 hour from now.
// signer := sign.NewURLSigner(keyID, privKey)
// signedURL, err := signer.Sign(rawURL, time.Now().Add(1*time.Hour))
// if err != nil {
// log.Fatalf("Failed to sign url, err: %s\n", err.Error())
// }
//
package sign
import (
"crypto/rsa"
"fmt"
"net/url"
"strings"
"time"
)
// An URLSigner provides URL signing utilities to sign URLs for Amazon CloudFront
// resources. Using a private key and Credential Key Pair key ID the URLSigner
// only needs to be created once per Credential Key Pair key ID and private key.
//
// The signer is safe to use concurrently.
type URLSigner struct {
keyID string
privKey *rsa.PrivateKey
}
// NewURLSigner constructs and returns a new URLSigner to be used to for signing
// Amazon CloudFront URL resources with.
func NewURLSigner(keyID string, privKey *rsa.PrivateKey) *URLSigner {
return &URLSigner{
keyID: keyID,
privKey: privKey,
}
}
// Sign will sign a single URL to expire at the time of expires sign using the
// Amazon CloudFront default Canned Policy. The URL will be signed with the
// private key and Credential Key Pair Key ID previously provided to URLSigner.
//
// This is the default method of signing Amazon CloudFront URLs. If extra policy
// conditions are need other than URL expiry use SignWithPolicy instead.
//
// Example:
//
// // Sign URL to be valid for 1 hour from now.
// signer := sign.NewURLSigner(keyID, privKey)
// signedURL, err := signer.Sign(rawURL, time.Now().Add(1*time.Hour))
// if err != nil {
// log.Fatalf("Failed to sign url, err: %s\n", err.Error())
// }
//
func (s URLSigner) Sign(url string, expires time.Time) (string, error) {
scheme, cleanedURL, err := cleanURLScheme(url)
if err != nil {
return "", err
}
resource, err := CreateResource(scheme, url)
if err != nil {
return "", err
}
return signURL(scheme, cleanedURL, s.keyID, NewCannedPolicy(resource, expires), false, s.privKey)
}
// SignWithPolicy will sign a URL with the Policy provided. The URL will be
// signed with the private key and Credential Key Pair Key ID previously provided to URLSigner.
//
// Use this signing method if you are looking to sign a URL with more than just
// the URL's expiry time, or reusing Policies between multiple URL signings.
// If only the expiry time is needed you can use Sign and provide just the
// URL's expiry time. A minimum of at least one policy statement is required for a signed URL.
//
// Note: It is not safe to use Polices between multiple signers concurrently
//
// Example:
//
// // Sign URL to be valid for 30 minutes from now, expires one hour from now, and
// // restricted to the 192.0.2.0/24 IP address range.
// policy := &sign.Policy{
// Statements: []sign.Statement{
// {
// Resource: rawURL,
// Condition: sign.Condition{
// // Optional IP source address range
// IPAddress: &sign.IPAddress{SourceIP: "192.0.2.0/24"},
// // Optional date URL is not valid until
// DateGreaterThan: &sign.AWSEpochTime{time.Now().Add(30 * time.Minute)},
// // Required date the URL will expire after
// DateLessThan: &sign.AWSEpochTime{time.Now().Add(1 * time.Hour)},
// },
// },
// },
// }
//
// signer := sign.NewURLSigner(keyID, privKey)
// signedURL, err := signer.SignWithPolicy(rawURL, policy)
// if err != nil {
// log.Fatalf("Failed to sign url, err: %s\n", err.Error())
// }
//
func (s URLSigner) SignWithPolicy(url string, p *Policy) (string, error) {
scheme, cleanedURL, err := cleanURLScheme(url)
if err != nil {
return "", err
}
return signURL(scheme, cleanedURL, s.keyID, p, true, s.privKey)
}
func signURL(scheme, url, keyID string, p *Policy, customPolicy bool, privKey *rsa.PrivateKey) (string, error) {
// Validation URL elements
if err := validateURL(url); err != nil {
return "", err
}
b64Signature, b64Policy, err := p.Sign(privKey)
if err != nil {
return "", err
}
// build and return signed URL
builtURL := buildSignedURL(url, keyID, p, customPolicy, b64Policy, b64Signature)
if scheme == "rtmp" {
return buildRTMPURL(builtURL)
}
return builtURL, nil
}
func buildSignedURL(baseURL, keyID string, p *Policy, customPolicy bool, b64Policy, b64Signature []byte) string {
pred := "?"
if strings.Contains(baseURL, "?") {
pred = "&"
}
signedURL := baseURL + pred
if customPolicy {
signedURL += "Policy=" + string(b64Policy)
} else {
signedURL += fmt.Sprintf("Expires=%d", p.Statements[0].Condition.DateLessThan.UTC().Unix())
}
signedURL += fmt.Sprintf("&Signature=%s&Key-Pair-Id=%s", string(b64Signature), keyID)
return signedURL
}
func buildRTMPURL(u string) (string, error) {
parsed, err := url.Parse(u)
if err != nil {
return "", fmt.Errorf("unable to parse rtmp signed URL, err: %s", err)
}
rtmpURL := strings.TrimLeft(parsed.Path, "/")
if parsed.RawQuery != "" {
rtmpURL = fmt.Sprintf("%s?%s", rtmpURL, parsed.RawQuery)
}
return rtmpURL, nil
}
func cleanURLScheme(u string) (scheme, cleanedURL string, err error) {
parts := strings.SplitN(u, "://", 2)
if len(parts) != 2 {
return "", "", fmt.Errorf("invalid URL, missing scheme and domain/path")
}
scheme = strings.Replace(parts[0], "*", "", 1)
cleanedURL = fmt.Sprintf("%s://%s", scheme, parts[1])
return strings.ToLower(scheme), cleanedURL, nil
}
var illegalQueryParms = []string{"Expires", "Policy", "Signature", "Key-Pair-Id"}
func validateURL(u string) error {
parsed, err := url.Parse(u)
if err != nil {
return fmt.Errorf("unable to parse URL, err: %s", err.Error())
}
if parsed.Scheme == "" {
return fmt.Errorf("URL missing valid scheme, %s", u)
}
q := parsed.Query()
for _, p := range illegalQueryParms {
if _, ok := q[p]; ok {
return fmt.Errorf("%s cannot be a query parameter for a signed URL", p)
}
}
return nil
}

View File

@@ -1,149 +0,0 @@
package sign
import (
"crypto/rsa"
"math/rand"
"strings"
"testing"
"time"
)
var testSignTime = time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
var testSignURL = []struct {
u string
p *Policy
t time.Time
customPolicy bool
expectErr bool
out string
}{
{
"http://example.com/a", NewCannedPolicy("http://example.com/a", testSignTime), time.Time{}, true, false,
"http://example.com/a?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovL2V4YW1wbGUuY29tL2EiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjEyNTc4OTQwMDB9fX1dfQ__&Signature=Y6qvWOZNl99uNPMGprvrKXEmXpLWJ-xXKVHL~nmF0BR1jPb2XA2jor0MUYKBE4ViTkWZZ1dz46zSFMsEEfw~n6-SVYXZ2QHBBTkSAoxGtH6dH33Ph9pz~f9Wy7aYXq~9I-Ah0E6yC~BMiQuXe5qAOucuMPorKgPfC0dvLMw2EF0_&Key-Pair-Id=KeyID",
},
{
"http://example.com/a", nil, testSignTime, false, false,
"http://example.com/a?Expires=1257894000&Signature=Y6qvWOZNl99uNPMGprvrKXEmXpLWJ-xXKVHL~nmF0BR1jPb2XA2jor0MUYKBE4ViTkWZZ1dz46zSFMsEEfw~n6-SVYXZ2QHBBTkSAoxGtH6dH33Ph9pz~f9Wy7aYXq~9I-Ah0E6yC~BMiQuXe5qAOucuMPorKgPfC0dvLMw2EF0_&Key-Pair-Id=KeyID",
},
{
"http://example.com/Ƿ", nil, testSignTime, false, true,
"http://example.com/Ƿ?Expires=1257894000&Signature=Y6qvWOZNl99uNPMGprvrKXEmXpLWJ-xXKVHL~nmF0BR1jPb2XA2jor0MUYKBE4ViTkWZZ1dz46zSFMsEEfw~n6-SVYXZ2QHBBTkSAoxGtH6dH33Ph9pz~f9Wy7aYXq~9I-Ah0E6yC~BMiQuXe5qAOucuMPorKgPfC0dvLMw2EF0_&Key-Pair-Id=KeyID",
},
{
"http://example.com/a", &Policy{}, time.Time{}, true, true,
"http://example.com/a?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovL2V4YW1wbGUuY29tL2EiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjEyNTc4OTQwMDB9fX1dfQ__&Signature=Y6qvWOZNl99uNPMGprvrKXEmXpLWJ-xXKVHL~nmF0BR1jPb2XA2jor0MUYKBE4ViTkWZZ1dz46zSFMsEEfw~n6-SVYXZ2QHBBTkSAoxGtH6dH33Ph9pz~f9Wy7aYXq~9I-Ah0E6yC~BMiQuXe5qAOucuMPorKgPfC0dvLMw2EF0_&Key-Pair-Id=KeyID",
},
{
"http://example.com/a", NewCannedPolicy("", testSignTime), time.Time{}, true, true,
"http://example.com/a?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cDovL2V4YW1wbGUuY29tL2EiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjEyNTc4OTQwMDB9fX1dfQ__&Signature=Y6qvWOZNl99uNPMGprvrKXEmXpLWJ-xXKVHL~nmF0BR1jPb2XA2jor0MUYKBE4ViTkWZZ1dz46zSFMsEEfw~n6-SVYXZ2QHBBTkSAoxGtH6dH33Ph9pz~f9Wy7aYXq~9I-Ah0E6yC~BMiQuXe5qAOucuMPorKgPfC0dvLMw2EF0_&Key-Pair-Id=KeyID",
},
{
"rtmp://example.com/a", nil, testSignTime, false, false,
"a?Expires=1257894000&Signature=Ds9NbpGwIcDKG1iZDyjfPXp0ZFYSIzfvGzJj-x28XlXfrarHrJbTOQj3bec~aAyb8NAqghBYRdKF9~RdjNrdyxyiequo-SCjFgFHnRNIk0FiqH0fVt2NO63f0X8-Kbur9cPtJoHR9Jzk0I1CQnECqhL6A0OgPhijTfKUITocmzA_&Key-Pair-Id=KeyID",
},
{
"rtmp://example.com/a", NewCannedPolicy("a", testSignTime), time.Time{}, true, false,
"a?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiYSIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTI1Nzg5NDAwMH19fV19&Signature=Ds9NbpGwIcDKG1iZDyjfPXp0ZFYSIzfvGzJj-x28XlXfrarHrJbTOQj3bec~aAyb8NAqghBYRdKF9~RdjNrdyxyiequo-SCjFgFHnRNIk0FiqH0fVt2NO63f0X8-Kbur9cPtJoHR9Jzk0I1CQnECqhL6A0OgPhijTfKUITocmzA_&Key-Pair-Id=KeyID",
},
}
// TODO Sign URL HTTP
// TODO Sign URL RMTP
func TestSignURL(t *testing.T) {
origRandReader := randReader
randReader = newRandomReader(rand.New(rand.NewSource(1)))
defer func() {
randReader = origRandReader
}()
privKey, err := rsa.GenerateKey(randReader, 1024)
if err != nil {
t.Fatalf("Unexpected priv key error, %#v", err)
}
s := NewURLSigner("KeyID", privKey)
for i, v := range testSignURL {
var u string
var err error
if v.customPolicy {
u, err = s.SignWithPolicy(v.u, v.p)
} else {
u, err = s.Sign(v.u, v.t)
}
if err != nil {
if v.expectErr {
continue
}
t.Errorf("%d, Unexpected error, %s", i, err.Error())
continue
} else if v.expectErr {
t.Errorf("%d Expected error, but got none", i)
continue
}
if u != v.out {
t.Errorf("%d, Unexpected URL\nexpect: %s\nactual: %s\n", i, v.out, u)
}
}
}
var testBuildSignedURL = []struct {
u, keyID string
p *Policy
customPolicy bool
b64Policy, b64Sig []byte
out string
}{
{
"https://example.com/a?b=1", "KeyID", NewCannedPolicy("", testSignTime), true, []byte("b64Policy"), []byte("b64Sig"),
"https://example.com/a?b=1&Policy=b64Policy&Signature=b64Sig&Key-Pair-Id=KeyID",
},
{
"https://example.com/a", "KeyID", NewCannedPolicy("", testSignTime), true, []byte("b64Policy"), []byte("b64Sig"),
"https://example.com/a?Policy=b64Policy&Signature=b64Sig&Key-Pair-Id=KeyID",
},
{
"https://example.com/a?b=1", "KeyID", NewCannedPolicy("https://example.com/a?b=1", testSignTime), false, []byte("b64Policy"), []byte("b64Sig"),
"https://example.com/a?b=1&Expires=1257894000&Signature=b64Sig&Key-Pair-Id=KeyID",
},
}
func TestBuildSignedURL(t *testing.T) {
for i, v := range testBuildSignedURL {
u := buildSignedURL(v.u, v.keyID, v.p, v.customPolicy, v.b64Policy, v.b64Sig)
if u != v.out {
t.Errorf("%d, Unexpected URL\nexpect: %s\nactual: %s\n", i, v.out, u)
}
}
}
var testValidURL = []struct {
in, errPrefix string
}{
{"https://example.com/a?b=1&else=b", ""},
{"https://example.com/a?b=1&Policy=something&else=b", "Policy"},
{"https://example.com/a?b=1&Signature=something&else=b", "Signature"},
{"https://example.com/a?b=1&Key-Pair-Id=something&else=b", "Key-Pair-Id"},
{"http?://example.com/a?b=1", "URL missing valid scheme"},
}
func TestValidateURL(t *testing.T) {
for i, v := range testValidURL {
err := validateURL(v.in)
if err != nil {
if v.errPrefix == "" {
t.Errorf("%d, Unexpected error %s", i, err.Error())
}
if !strings.HasPrefix(err.Error(), v.errPrefix) {
t.Errorf("%d, Expected to find prefix\nexpect: %s\nactual: %s", i, v.errPrefix, err.Error())
}
} else if v.errPrefix != "" {
t.Errorf("%d, Expected error %s", i, v.errPrefix)
}
}
}

View File

@@ -1,76 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudfront
import (
"github.com/aws/aws-sdk-go/private/waiter"
)
func (c *CloudFront) WaitUntilDistributionDeployed(input *GetDistributionInput) error {
waiterCfg := waiter.Config{
Operation: "GetDistribution",
Delay: 60,
MaxAttempts: 25,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "Distribution.Status",
Expected: "Deployed",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *CloudFront) WaitUntilInvalidationCompleted(input *GetInvalidationInput) error {
waiterCfg := waiter.Config{
Operation: "GetInvalidation",
Delay: 20,
MaxAttempts: 30,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "Invalidation.Status",
Expected: "Completed",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *CloudFront) WaitUntilStreamingDistributionDeployed(input *GetStreamingDistributionInput) error {
waiterCfg := waiter.Config{
Operation: "GetStreamingDistribution",
Delay: 60,
MaxAttempts: 25,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "StreamingDistribution.Status",
Expected: "Deployed",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,94 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudhsmiface provides an interface for the Amazon CloudHSM.
package cloudhsmiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudhsm"
)
// CloudHSMAPI is the interface type for cloudhsm.CloudHSM.
type CloudHSMAPI interface {
AddTagsToResourceRequest(*cloudhsm.AddTagsToResourceInput) (*request.Request, *cloudhsm.AddTagsToResourceOutput)
AddTagsToResource(*cloudhsm.AddTagsToResourceInput) (*cloudhsm.AddTagsToResourceOutput, error)
CreateHapgRequest(*cloudhsm.CreateHapgInput) (*request.Request, *cloudhsm.CreateHapgOutput)
CreateHapg(*cloudhsm.CreateHapgInput) (*cloudhsm.CreateHapgOutput, error)
CreateHsmRequest(*cloudhsm.CreateHsmInput) (*request.Request, *cloudhsm.CreateHsmOutput)
CreateHsm(*cloudhsm.CreateHsmInput) (*cloudhsm.CreateHsmOutput, error)
CreateLunaClientRequest(*cloudhsm.CreateLunaClientInput) (*request.Request, *cloudhsm.CreateLunaClientOutput)
CreateLunaClient(*cloudhsm.CreateLunaClientInput) (*cloudhsm.CreateLunaClientOutput, error)
DeleteHapgRequest(*cloudhsm.DeleteHapgInput) (*request.Request, *cloudhsm.DeleteHapgOutput)
DeleteHapg(*cloudhsm.DeleteHapgInput) (*cloudhsm.DeleteHapgOutput, error)
DeleteHsmRequest(*cloudhsm.DeleteHsmInput) (*request.Request, *cloudhsm.DeleteHsmOutput)
DeleteHsm(*cloudhsm.DeleteHsmInput) (*cloudhsm.DeleteHsmOutput, error)
DeleteLunaClientRequest(*cloudhsm.DeleteLunaClientInput) (*request.Request, *cloudhsm.DeleteLunaClientOutput)
DeleteLunaClient(*cloudhsm.DeleteLunaClientInput) (*cloudhsm.DeleteLunaClientOutput, error)
DescribeHapgRequest(*cloudhsm.DescribeHapgInput) (*request.Request, *cloudhsm.DescribeHapgOutput)
DescribeHapg(*cloudhsm.DescribeHapgInput) (*cloudhsm.DescribeHapgOutput, error)
DescribeHsmRequest(*cloudhsm.DescribeHsmInput) (*request.Request, *cloudhsm.DescribeHsmOutput)
DescribeHsm(*cloudhsm.DescribeHsmInput) (*cloudhsm.DescribeHsmOutput, error)
DescribeLunaClientRequest(*cloudhsm.DescribeLunaClientInput) (*request.Request, *cloudhsm.DescribeLunaClientOutput)
DescribeLunaClient(*cloudhsm.DescribeLunaClientInput) (*cloudhsm.DescribeLunaClientOutput, error)
GetConfigRequest(*cloudhsm.GetConfigInput) (*request.Request, *cloudhsm.GetConfigOutput)
GetConfig(*cloudhsm.GetConfigInput) (*cloudhsm.GetConfigOutput, error)
ListAvailableZonesRequest(*cloudhsm.ListAvailableZonesInput) (*request.Request, *cloudhsm.ListAvailableZonesOutput)
ListAvailableZones(*cloudhsm.ListAvailableZonesInput) (*cloudhsm.ListAvailableZonesOutput, error)
ListHapgsRequest(*cloudhsm.ListHapgsInput) (*request.Request, *cloudhsm.ListHapgsOutput)
ListHapgs(*cloudhsm.ListHapgsInput) (*cloudhsm.ListHapgsOutput, error)
ListHsmsRequest(*cloudhsm.ListHsmsInput) (*request.Request, *cloudhsm.ListHsmsOutput)
ListHsms(*cloudhsm.ListHsmsInput) (*cloudhsm.ListHsmsOutput, error)
ListLunaClientsRequest(*cloudhsm.ListLunaClientsInput) (*request.Request, *cloudhsm.ListLunaClientsOutput)
ListLunaClients(*cloudhsm.ListLunaClientsInput) (*cloudhsm.ListLunaClientsOutput, error)
ListTagsForResourceRequest(*cloudhsm.ListTagsForResourceInput) (*request.Request, *cloudhsm.ListTagsForResourceOutput)
ListTagsForResource(*cloudhsm.ListTagsForResourceInput) (*cloudhsm.ListTagsForResourceOutput, error)
ModifyHapgRequest(*cloudhsm.ModifyHapgInput) (*request.Request, *cloudhsm.ModifyHapgOutput)
ModifyHapg(*cloudhsm.ModifyHapgInput) (*cloudhsm.ModifyHapgOutput, error)
ModifyHsmRequest(*cloudhsm.ModifyHsmInput) (*request.Request, *cloudhsm.ModifyHsmOutput)
ModifyHsm(*cloudhsm.ModifyHsmInput) (*cloudhsm.ModifyHsmOutput, error)
ModifyLunaClientRequest(*cloudhsm.ModifyLunaClientInput) (*request.Request, *cloudhsm.ModifyLunaClientOutput)
ModifyLunaClient(*cloudhsm.ModifyLunaClientInput) (*cloudhsm.ModifyLunaClientOutput, error)
RemoveTagsFromResourceRequest(*cloudhsm.RemoveTagsFromResourceInput) (*request.Request, *cloudhsm.RemoveTagsFromResourceOutput)
RemoveTagsFromResource(*cloudhsm.RemoveTagsFromResourceInput) (*cloudhsm.RemoveTagsFromResourceOutput, error)
}
var _ CloudHSMAPI = (*cloudhsm.CloudHSM)(nil)

View File

@@ -1,431 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudhsm_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudhsm"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudHSM_AddTagsToResource() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.AddTagsToResourceInput{
ResourceArn: aws.String("String"), // Required
TagList: []*cloudhsm.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"), // Required
},
// More values...
},
}
resp, err := svc.AddTagsToResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_CreateHapg() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.CreateHapgInput{
Label: aws.String("Label"), // Required
}
resp, err := svc.CreateHapg(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_CreateHsm() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.CreateHsmInput{
IamRoleArn: aws.String("IamRoleArn"), // Required
SshKey: aws.String("SshKey"), // Required
SubnetId: aws.String("SubnetId"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
ClientToken: aws.String("ClientToken"),
EniIp: aws.String("IpAddress"),
ExternalId: aws.String("ExternalId"),
SyslogIp: aws.String("IpAddress"),
}
resp, err := svc.CreateHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_CreateLunaClient() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.CreateLunaClientInput{
Certificate: aws.String("Certificate"), // Required
Label: aws.String("ClientLabel"),
}
resp, err := svc.CreateLunaClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_DeleteHapg() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.DeleteHapgInput{
HapgArn: aws.String("HapgArn"), // Required
}
resp, err := svc.DeleteHapg(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_DeleteHsm() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.DeleteHsmInput{
HsmArn: aws.String("HsmArn"), // Required
}
resp, err := svc.DeleteHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_DeleteLunaClient() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.DeleteLunaClientInput{
ClientArn: aws.String("ClientArn"), // Required
}
resp, err := svc.DeleteLunaClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_DescribeHapg() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.DescribeHapgInput{
HapgArn: aws.String("HapgArn"), // Required
}
resp, err := svc.DescribeHapg(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_DescribeHsm() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.DescribeHsmInput{
HsmArn: aws.String("HsmArn"),
HsmSerialNumber: aws.String("HsmSerialNumber"),
}
resp, err := svc.DescribeHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_DescribeLunaClient() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.DescribeLunaClientInput{
CertificateFingerprint: aws.String("CertificateFingerprint"),
ClientArn: aws.String("ClientArn"),
}
resp, err := svc.DescribeLunaClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_GetConfig() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.GetConfigInput{
ClientArn: aws.String("ClientArn"), // Required
ClientVersion: aws.String("ClientVersion"), // Required
HapgList: []*string{ // Required
aws.String("HapgArn"), // Required
// More values...
},
}
resp, err := svc.GetConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ListAvailableZones() {
svc := cloudhsm.New(session.New())
var params *cloudhsm.ListAvailableZonesInput
resp, err := svc.ListAvailableZones(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ListHapgs() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ListHapgsInput{
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListHapgs(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ListHsms() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ListHsmsInput{
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListHsms(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ListLunaClients() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ListLunaClientsInput{
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListLunaClients(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ListTagsForResource() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ListTagsForResourceInput{
ResourceArn: aws.String("String"), // Required
}
resp, err := svc.ListTagsForResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ModifyHapg() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ModifyHapgInput{
HapgArn: aws.String("HapgArn"), // Required
Label: aws.String("Label"),
PartitionSerialList: []*string{
aws.String("PartitionSerial"), // Required
// More values...
},
}
resp, err := svc.ModifyHapg(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ModifyHsm() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ModifyHsmInput{
HsmArn: aws.String("HsmArn"), // Required
EniIp: aws.String("IpAddress"),
ExternalId: aws.String("ExternalId"),
IamRoleArn: aws.String("IamRoleArn"),
SubnetId: aws.String("SubnetId"),
SyslogIp: aws.String("IpAddress"),
}
resp, err := svc.ModifyHsm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_ModifyLunaClient() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.ModifyLunaClientInput{
Certificate: aws.String("Certificate"), // Required
ClientArn: aws.String("ClientArn"), // Required
}
resp, err := svc.ModifyLunaClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudHSM_RemoveTagsFromResource() {
svc := cloudhsm.New(session.New())
params := &cloudhsm.RemoveTagsFromResourceInput{
ResourceArn: aws.String("String"), // Required
TagKeyList: []*string{ // Required
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.RemoveTagsFromResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,87 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudhsm
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudHSM struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cloudhsm"
// New creates a new instance of the CloudHSM client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudHSM client from just a session.
// svc := cloudhsm.New(mySession)
//
// // Create a CloudHSM client with additional configuration
// svc := cloudhsm.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudHSM {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudHSM {
svc := &CloudHSM{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2014-05-30",
JSONVersion: "1.1",
TargetPrefix: "CloudHsmFrontendService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudHSM operation and runs any
// custom request initialization.
func (c *CloudHSM) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,110 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudsearchiface provides an interface for the Amazon CloudSearch.
package cloudsearchiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudsearch"
)
// CloudSearchAPI is the interface type for cloudsearch.CloudSearch.
type CloudSearchAPI interface {
BuildSuggestersRequest(*cloudsearch.BuildSuggestersInput) (*request.Request, *cloudsearch.BuildSuggestersOutput)
BuildSuggesters(*cloudsearch.BuildSuggestersInput) (*cloudsearch.BuildSuggestersOutput, error)
CreateDomainRequest(*cloudsearch.CreateDomainInput) (*request.Request, *cloudsearch.CreateDomainOutput)
CreateDomain(*cloudsearch.CreateDomainInput) (*cloudsearch.CreateDomainOutput, error)
DefineAnalysisSchemeRequest(*cloudsearch.DefineAnalysisSchemeInput) (*request.Request, *cloudsearch.DefineAnalysisSchemeOutput)
DefineAnalysisScheme(*cloudsearch.DefineAnalysisSchemeInput) (*cloudsearch.DefineAnalysisSchemeOutput, error)
DefineExpressionRequest(*cloudsearch.DefineExpressionInput) (*request.Request, *cloudsearch.DefineExpressionOutput)
DefineExpression(*cloudsearch.DefineExpressionInput) (*cloudsearch.DefineExpressionOutput, error)
DefineIndexFieldRequest(*cloudsearch.DefineIndexFieldInput) (*request.Request, *cloudsearch.DefineIndexFieldOutput)
DefineIndexField(*cloudsearch.DefineIndexFieldInput) (*cloudsearch.DefineIndexFieldOutput, error)
DefineSuggesterRequest(*cloudsearch.DefineSuggesterInput) (*request.Request, *cloudsearch.DefineSuggesterOutput)
DefineSuggester(*cloudsearch.DefineSuggesterInput) (*cloudsearch.DefineSuggesterOutput, error)
DeleteAnalysisSchemeRequest(*cloudsearch.DeleteAnalysisSchemeInput) (*request.Request, *cloudsearch.DeleteAnalysisSchemeOutput)
DeleteAnalysisScheme(*cloudsearch.DeleteAnalysisSchemeInput) (*cloudsearch.DeleteAnalysisSchemeOutput, error)
DeleteDomainRequest(*cloudsearch.DeleteDomainInput) (*request.Request, *cloudsearch.DeleteDomainOutput)
DeleteDomain(*cloudsearch.DeleteDomainInput) (*cloudsearch.DeleteDomainOutput, error)
DeleteExpressionRequest(*cloudsearch.DeleteExpressionInput) (*request.Request, *cloudsearch.DeleteExpressionOutput)
DeleteExpression(*cloudsearch.DeleteExpressionInput) (*cloudsearch.DeleteExpressionOutput, error)
DeleteIndexFieldRequest(*cloudsearch.DeleteIndexFieldInput) (*request.Request, *cloudsearch.DeleteIndexFieldOutput)
DeleteIndexField(*cloudsearch.DeleteIndexFieldInput) (*cloudsearch.DeleteIndexFieldOutput, error)
DeleteSuggesterRequest(*cloudsearch.DeleteSuggesterInput) (*request.Request, *cloudsearch.DeleteSuggesterOutput)
DeleteSuggester(*cloudsearch.DeleteSuggesterInput) (*cloudsearch.DeleteSuggesterOutput, error)
DescribeAnalysisSchemesRequest(*cloudsearch.DescribeAnalysisSchemesInput) (*request.Request, *cloudsearch.DescribeAnalysisSchemesOutput)
DescribeAnalysisSchemes(*cloudsearch.DescribeAnalysisSchemesInput) (*cloudsearch.DescribeAnalysisSchemesOutput, error)
DescribeAvailabilityOptionsRequest(*cloudsearch.DescribeAvailabilityOptionsInput) (*request.Request, *cloudsearch.DescribeAvailabilityOptionsOutput)
DescribeAvailabilityOptions(*cloudsearch.DescribeAvailabilityOptionsInput) (*cloudsearch.DescribeAvailabilityOptionsOutput, error)
DescribeDomainsRequest(*cloudsearch.DescribeDomainsInput) (*request.Request, *cloudsearch.DescribeDomainsOutput)
DescribeDomains(*cloudsearch.DescribeDomainsInput) (*cloudsearch.DescribeDomainsOutput, error)
DescribeExpressionsRequest(*cloudsearch.DescribeExpressionsInput) (*request.Request, *cloudsearch.DescribeExpressionsOutput)
DescribeExpressions(*cloudsearch.DescribeExpressionsInput) (*cloudsearch.DescribeExpressionsOutput, error)
DescribeIndexFieldsRequest(*cloudsearch.DescribeIndexFieldsInput) (*request.Request, *cloudsearch.DescribeIndexFieldsOutput)
DescribeIndexFields(*cloudsearch.DescribeIndexFieldsInput) (*cloudsearch.DescribeIndexFieldsOutput, error)
DescribeScalingParametersRequest(*cloudsearch.DescribeScalingParametersInput) (*request.Request, *cloudsearch.DescribeScalingParametersOutput)
DescribeScalingParameters(*cloudsearch.DescribeScalingParametersInput) (*cloudsearch.DescribeScalingParametersOutput, error)
DescribeServiceAccessPoliciesRequest(*cloudsearch.DescribeServiceAccessPoliciesInput) (*request.Request, *cloudsearch.DescribeServiceAccessPoliciesOutput)
DescribeServiceAccessPolicies(*cloudsearch.DescribeServiceAccessPoliciesInput) (*cloudsearch.DescribeServiceAccessPoliciesOutput, error)
DescribeSuggestersRequest(*cloudsearch.DescribeSuggestersInput) (*request.Request, *cloudsearch.DescribeSuggestersOutput)
DescribeSuggesters(*cloudsearch.DescribeSuggestersInput) (*cloudsearch.DescribeSuggestersOutput, error)
IndexDocumentsRequest(*cloudsearch.IndexDocumentsInput) (*request.Request, *cloudsearch.IndexDocumentsOutput)
IndexDocuments(*cloudsearch.IndexDocumentsInput) (*cloudsearch.IndexDocumentsOutput, error)
ListDomainNamesRequest(*cloudsearch.ListDomainNamesInput) (*request.Request, *cloudsearch.ListDomainNamesOutput)
ListDomainNames(*cloudsearch.ListDomainNamesInput) (*cloudsearch.ListDomainNamesOutput, error)
UpdateAvailabilityOptionsRequest(*cloudsearch.UpdateAvailabilityOptionsInput) (*request.Request, *cloudsearch.UpdateAvailabilityOptionsOutput)
UpdateAvailabilityOptions(*cloudsearch.UpdateAvailabilityOptionsInput) (*cloudsearch.UpdateAvailabilityOptionsOutput, error)
UpdateScalingParametersRequest(*cloudsearch.UpdateScalingParametersInput) (*request.Request, *cloudsearch.UpdateScalingParametersOutput)
UpdateScalingParameters(*cloudsearch.UpdateScalingParametersInput) (*cloudsearch.UpdateScalingParametersOutput, error)
UpdateServiceAccessPoliciesRequest(*cloudsearch.UpdateServiceAccessPoliciesInput) (*request.Request, *cloudsearch.UpdateServiceAccessPoliciesOutput)
UpdateServiceAccessPolicies(*cloudsearch.UpdateServiceAccessPoliciesInput) (*cloudsearch.UpdateServiceAccessPoliciesOutput, error)
}
var _ CloudSearchAPI = (*cloudsearch.CloudSearch)(nil)

View File

@@ -1,616 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudsearch_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudsearch"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudSearch_BuildSuggesters() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.BuildSuggestersInput{
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.BuildSuggesters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_CreateDomain() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.CreateDomainInput{
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.CreateDomain(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DefineAnalysisScheme() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DefineAnalysisSchemeInput{
AnalysisScheme: &cloudsearch.AnalysisScheme{ // Required
AnalysisSchemeLanguage: aws.String("AnalysisSchemeLanguage"), // Required
AnalysisSchemeName: aws.String("StandardName"), // Required
AnalysisOptions: &cloudsearch.AnalysisOptions{
AlgorithmicStemming: aws.String("AlgorithmicStemming"),
JapaneseTokenizationDictionary: aws.String("String"),
StemmingDictionary: aws.String("String"),
Stopwords: aws.String("String"),
Synonyms: aws.String("String"),
},
},
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.DefineAnalysisScheme(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DefineExpression() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DefineExpressionInput{
DomainName: aws.String("DomainName"), // Required
Expression: &cloudsearch.Expression{ // Required
ExpressionName: aws.String("StandardName"), // Required
ExpressionValue: aws.String("ExpressionValue"), // Required
},
}
resp, err := svc.DefineExpression(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DefineIndexField() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DefineIndexFieldInput{
DomainName: aws.String("DomainName"), // Required
IndexField: &cloudsearch.IndexField{ // Required
IndexFieldName: aws.String("DynamicFieldName"), // Required
IndexFieldType: aws.String("IndexFieldType"), // Required
DateArrayOptions: &cloudsearch.DateArrayOptions{
DefaultValue: aws.String("FieldValue"),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SourceFields: aws.String("FieldNameCommaList"),
},
DateOptions: &cloudsearch.DateOptions{
DefaultValue: aws.String("FieldValue"),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SortEnabled: aws.Bool(true),
SourceField: aws.String("FieldName"),
},
DoubleArrayOptions: &cloudsearch.DoubleArrayOptions{
DefaultValue: aws.Float64(1.0),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SourceFields: aws.String("FieldNameCommaList"),
},
DoubleOptions: &cloudsearch.DoubleOptions{
DefaultValue: aws.Float64(1.0),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SortEnabled: aws.Bool(true),
SourceField: aws.String("FieldName"),
},
IntArrayOptions: &cloudsearch.IntArrayOptions{
DefaultValue: aws.Int64(1),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SourceFields: aws.String("FieldNameCommaList"),
},
IntOptions: &cloudsearch.IntOptions{
DefaultValue: aws.Int64(1),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SortEnabled: aws.Bool(true),
SourceField: aws.String("FieldName"),
},
LatLonOptions: &cloudsearch.LatLonOptions{
DefaultValue: aws.String("FieldValue"),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SortEnabled: aws.Bool(true),
SourceField: aws.String("FieldName"),
},
LiteralArrayOptions: &cloudsearch.LiteralArrayOptions{
DefaultValue: aws.String("FieldValue"),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SourceFields: aws.String("FieldNameCommaList"),
},
LiteralOptions: &cloudsearch.LiteralOptions{
DefaultValue: aws.String("FieldValue"),
FacetEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SearchEnabled: aws.Bool(true),
SortEnabled: aws.Bool(true),
SourceField: aws.String("FieldName"),
},
TextArrayOptions: &cloudsearch.TextArrayOptions{
AnalysisScheme: aws.String("Word"),
DefaultValue: aws.String("FieldValue"),
HighlightEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SourceFields: aws.String("FieldNameCommaList"),
},
TextOptions: &cloudsearch.TextOptions{
AnalysisScheme: aws.String("Word"),
DefaultValue: aws.String("FieldValue"),
HighlightEnabled: aws.Bool(true),
ReturnEnabled: aws.Bool(true),
SortEnabled: aws.Bool(true),
SourceField: aws.String("FieldName"),
},
},
}
resp, err := svc.DefineIndexField(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DefineSuggester() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DefineSuggesterInput{
DomainName: aws.String("DomainName"), // Required
Suggester: &cloudsearch.Suggester{ // Required
DocumentSuggesterOptions: &cloudsearch.DocumentSuggesterOptions{ // Required
SourceField: aws.String("FieldName"), // Required
FuzzyMatching: aws.String("SuggesterFuzzyMatching"),
SortExpression: aws.String("String"),
},
SuggesterName: aws.String("StandardName"), // Required
},
}
resp, err := svc.DefineSuggester(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DeleteAnalysisScheme() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DeleteAnalysisSchemeInput{
AnalysisSchemeName: aws.String("StandardName"), // Required
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.DeleteAnalysisScheme(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DeleteDomain() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DeleteDomainInput{
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.DeleteDomain(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DeleteExpression() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DeleteExpressionInput{
DomainName: aws.String("DomainName"), // Required
ExpressionName: aws.String("StandardName"), // Required
}
resp, err := svc.DeleteExpression(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DeleteIndexField() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DeleteIndexFieldInput{
DomainName: aws.String("DomainName"), // Required
IndexFieldName: aws.String("DynamicFieldName"), // Required
}
resp, err := svc.DeleteIndexField(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DeleteSuggester() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DeleteSuggesterInput{
DomainName: aws.String("DomainName"), // Required
SuggesterName: aws.String("StandardName"), // Required
}
resp, err := svc.DeleteSuggester(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeAnalysisSchemes() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeAnalysisSchemesInput{
DomainName: aws.String("DomainName"), // Required
AnalysisSchemeNames: []*string{
aws.String("StandardName"), // Required
// More values...
},
Deployed: aws.Bool(true),
}
resp, err := svc.DescribeAnalysisSchemes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeAvailabilityOptions() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeAvailabilityOptionsInput{
DomainName: aws.String("DomainName"), // Required
Deployed: aws.Bool(true),
}
resp, err := svc.DescribeAvailabilityOptions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeDomains() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeDomainsInput{
DomainNames: []*string{
aws.String("DomainName"), // Required
// More values...
},
}
resp, err := svc.DescribeDomains(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeExpressions() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeExpressionsInput{
DomainName: aws.String("DomainName"), // Required
Deployed: aws.Bool(true),
ExpressionNames: []*string{
aws.String("StandardName"), // Required
// More values...
},
}
resp, err := svc.DescribeExpressions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeIndexFields() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeIndexFieldsInput{
DomainName: aws.String("DomainName"), // Required
Deployed: aws.Bool(true),
FieldNames: []*string{
aws.String("DynamicFieldName"), // Required
// More values...
},
}
resp, err := svc.DescribeIndexFields(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeScalingParameters() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeScalingParametersInput{
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.DescribeScalingParameters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeServiceAccessPolicies() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeServiceAccessPoliciesInput{
DomainName: aws.String("DomainName"), // Required
Deployed: aws.Bool(true),
}
resp, err := svc.DescribeServiceAccessPolicies(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_DescribeSuggesters() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.DescribeSuggestersInput{
DomainName: aws.String("DomainName"), // Required
Deployed: aws.Bool(true),
SuggesterNames: []*string{
aws.String("StandardName"), // Required
// More values...
},
}
resp, err := svc.DescribeSuggesters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_IndexDocuments() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.IndexDocumentsInput{
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.IndexDocuments(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_ListDomainNames() {
svc := cloudsearch.New(session.New())
var params *cloudsearch.ListDomainNamesInput
resp, err := svc.ListDomainNames(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_UpdateAvailabilityOptions() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.UpdateAvailabilityOptionsInput{
DomainName: aws.String("DomainName"), // Required
MultiAZ: aws.Bool(true), // Required
}
resp, err := svc.UpdateAvailabilityOptions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_UpdateScalingParameters() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.UpdateScalingParametersInput{
DomainName: aws.String("DomainName"), // Required
ScalingParameters: &cloudsearch.ScalingParameters{ // Required
DesiredInstanceType: aws.String("PartitionInstanceType"),
DesiredPartitionCount: aws.Int64(1),
DesiredReplicationCount: aws.Int64(1),
},
}
resp, err := svc.UpdateScalingParameters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearch_UpdateServiceAccessPolicies() {
svc := cloudsearch.New(session.New())
params := &cloudsearch.UpdateServiceAccessPoliciesInput{
AccessPolicies: aws.String("PolicyDocument"), // Required
DomainName: aws.String("DomainName"), // Required
}
resp, err := svc.UpdateServiceAccessPolicies(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,94 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudsearch
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// You use the Amazon CloudSearch configuration service to create, configure,
// and manage search domains. Configuration service requests are submitted using
// the AWS Query protocol. AWS Query requests are HTTP or HTTPS requests submitted
// via HTTP GET or POST with a query parameter named Action.
//
// The endpoint for configuration service requests is region-specific: cloudsearch.region.amazonaws.com.
// For example, cloudsearch.us-east-1.amazonaws.com. For a current list of supported
// regions and endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#cloudsearch_region"
// target="_blank).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudSearch struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cloudsearch"
// New creates a new instance of the CloudSearch client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudSearch client from just a session.
// svc := cloudsearch.New(mySession)
//
// // Create a CloudSearch client with additional configuration
// svc := cloudsearch.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudSearch {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudSearch {
svc := &CloudSearch{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2013-01-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudSearch operation and runs any
// custom request initialization.
func (c *CloudSearch) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View File

@@ -1,964 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudsearchdomain provides a client for Amazon CloudSearch Domain.
package cloudsearchdomain
import (
"io"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
)
const opSearch = "Search"
// SearchRequest generates a "aws/request.Request" representing the
// client's request for the Search operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the Search method directly
// instead.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the SearchRequest method.
// req, resp := client.SearchRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
func (c *CloudSearchDomain) SearchRequest(input *SearchInput) (req *request.Request, output *SearchOutput) {
op := &request.Operation{
Name: opSearch,
HTTPMethod: "GET",
HTTPPath: "/2013-01-01/search?format=sdk&pretty=true",
}
if input == nil {
input = &SearchInput{}
}
req = c.newRequest(op, input, output)
output = &SearchOutput{}
req.Data = output
return
}
// Retrieves a list of documents that match the specified search criteria. How
// you specify the search criteria depends on which query parser you use. Amazon
// CloudSearch supports four query parsers:
//
// simple: search all text and text-array fields for the specified string.
// Search for phrases, individual terms, and prefixes. structured: search specific
// fields, construct compound queries using Boolean operators, and use advanced
// features such as term boosting and proximity searching. lucene: specify search
// criteria using the Apache Lucene query parser syntax. dismax: specify search
// criteria using the simplified subset of the Apache Lucene query parser syntax
// defined by the DisMax query parser. For more information, see Searching
// Your Data (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching.html)
// in the Amazon CloudSearch Developer Guide.
//
// The endpoint for submitting Search requests is domain-specific. You submit
// search requests to a domain's search endpoint. To get the search endpoint
// for your domain, use the Amazon CloudSearch configuration service DescribeDomains
// action. A domain's endpoints are also displayed on the domain dashboard in
// the Amazon CloudSearch console.
func (c *CloudSearchDomain) Search(input *SearchInput) (*SearchOutput, error) {
req, out := c.SearchRequest(input)
err := req.Send()
return out, err
}
const opSuggest = "Suggest"
// SuggestRequest generates a "aws/request.Request" representing the
// client's request for the Suggest operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the Suggest method directly
// instead.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the SuggestRequest method.
// req, resp := client.SuggestRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
func (c *CloudSearchDomain) SuggestRequest(input *SuggestInput) (req *request.Request, output *SuggestOutput) {
op := &request.Operation{
Name: opSuggest,
HTTPMethod: "GET",
HTTPPath: "/2013-01-01/suggest?format=sdk&pretty=true",
}
if input == nil {
input = &SuggestInput{}
}
req = c.newRequest(op, input, output)
output = &SuggestOutput{}
req.Data = output
return
}
// Retrieves autocomplete suggestions for a partial query string. You can use
// suggestions enable you to display likely matches before users finish typing.
// In Amazon CloudSearch, suggestions are based on the contents of a particular
// text field. When you request suggestions, Amazon CloudSearch finds all of
// the documents whose values in the suggester field start with the specified
// query string. The beginning of the field must match the query string to be
// considered a match.
//
// For more information about configuring suggesters and retrieving suggestions,
// see Getting Suggestions (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/getting-suggestions.html)
// in the Amazon CloudSearch Developer Guide.
//
// The endpoint for submitting Suggest requests is domain-specific. You submit
// suggest requests to a domain's search endpoint. To get the search endpoint
// for your domain, use the Amazon CloudSearch configuration service DescribeDomains
// action. A domain's endpoints are also displayed on the domain dashboard in
// the Amazon CloudSearch console.
func (c *CloudSearchDomain) Suggest(input *SuggestInput) (*SuggestOutput, error) {
req, out := c.SuggestRequest(input)
err := req.Send()
return out, err
}
const opUploadDocuments = "UploadDocuments"
// UploadDocumentsRequest generates a "aws/request.Request" representing the
// client's request for the UploadDocuments operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the UploadDocuments method directly
// instead.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the UploadDocumentsRequest method.
// req, resp := client.UploadDocumentsRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
func (c *CloudSearchDomain) UploadDocumentsRequest(input *UploadDocumentsInput) (req *request.Request, output *UploadDocumentsOutput) {
op := &request.Operation{
Name: opUploadDocuments,
HTTPMethod: "POST",
HTTPPath: "/2013-01-01/documents/batch?format=sdk",
}
if input == nil {
input = &UploadDocumentsInput{}
}
req = c.newRequest(op, input, output)
output = &UploadDocumentsOutput{}
req.Data = output
return
}
// Posts a batch of documents to a search domain for indexing. A document batch
// is a collection of add and delete operations that represent the documents
// you want to add, update, or delete from your domain. Batches can be described
// in either JSON or XML. Each item that you want Amazon CloudSearch to return
// as a search result (such as a product) is represented as a document. Every
// document has a unique ID and one or more fields that contain the data that
// you want to search and return in results. Individual documents cannot contain
// more than 1 MB of data. The entire batch cannot exceed 5 MB. To get the best
// possible upload performance, group add and delete operations in batches that
// are close the 5 MB limit. Submitting a large volume of single-document batches
// can overload a domain's document service.
//
// The endpoint for submitting UploadDocuments requests is domain-specific.
// To get the document endpoint for your domain, use the Amazon CloudSearch
// configuration service DescribeDomains action. A domain's endpoints are also
// displayed on the domain dashboard in the Amazon CloudSearch console.
//
// For more information about formatting your data for Amazon CloudSearch,
// see Preparing Your Data (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/preparing-data.html)
// in the Amazon CloudSearch Developer Guide. For more information about uploading
// data for indexing, see Uploading Data (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/uploading-data.html)
// in the Amazon CloudSearch Developer Guide.
func (c *CloudSearchDomain) UploadDocuments(input *UploadDocumentsInput) (*UploadDocumentsOutput, error) {
req, out := c.UploadDocumentsRequest(input)
err := req.Send()
return out, err
}
// A container for facet information.
type Bucket struct {
_ struct{} `type:"structure"`
// The number of hits that contain the facet value in the specified facet field.
Count *int64 `locationName:"count" type:"long"`
// The facet value being counted.
Value *string `locationName:"value" type:"string"`
}
// String returns the string representation
func (s Bucket) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s Bucket) GoString() string {
return s.String()
}
// A container for the calculated facet values and counts.
type BucketInfo struct {
_ struct{} `type:"structure"`
// A list of the calculated facet values and counts.
Buckets []*Bucket `locationName:"buckets" type:"list"`
}
// String returns the string representation
func (s BucketInfo) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s BucketInfo) GoString() string {
return s.String()
}
// A warning returned by the document service when an issue is discovered while
// processing an upload request.
type DocumentServiceWarning struct {
_ struct{} `type:"structure"`
// The description for a warning returned by the document service.
Message *string `locationName:"message" type:"string"`
}
// String returns the string representation
func (s DocumentServiceWarning) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s DocumentServiceWarning) GoString() string {
return s.String()
}
// The statistics for a field calculated in the request.
type FieldStats struct {
_ struct{} `type:"structure"`
// The number of documents that contain a value in the specified field in the
// result set.
Count *int64 `locationName:"count" type:"long"`
// The maximum value found in the specified field in the result set.
//
// If the field is numeric (int, int-array, double, or double-array), max is
// the string representation of a double-precision 64-bit floating point value.
// If the field is date or date-array, max is the string representation of a
// date with the format specified in IETF RFC3339 (http://tools.ietf.org/html/rfc3339):
// yyyy-mm-ddTHH:mm:ss.SSSZ.
Max *string `locationName:"max" type:"string"`
// The average of the values found in the specified field in the result set.
//
// If the field is numeric (int, int-array, double, or double-array), mean
// is the string representation of a double-precision 64-bit floating point
// value. If the field is date or date-array, mean is the string representation
// of a date with the format specified in IETF RFC3339 (http://tools.ietf.org/html/rfc3339):
// yyyy-mm-ddTHH:mm:ss.SSSZ.
Mean *string `locationName:"mean" type:"string"`
// The minimum value found in the specified field in the result set.
//
// If the field is numeric (int, int-array, double, or double-array), min is
// the string representation of a double-precision 64-bit floating point value.
// If the field is date or date-array, min is the string representation of a
// date with the format specified in IETF RFC3339 (http://tools.ietf.org/html/rfc3339):
// yyyy-mm-ddTHH:mm:ss.SSSZ.
Min *string `locationName:"min" type:"string"`
// The number of documents that do not contain a value in the specified field
// in the result set.
Missing *int64 `locationName:"missing" type:"long"`
// The standard deviation of the values in the specified field in the result
// set.
Stddev *float64 `locationName:"stddev" type:"double"`
// The sum of the field values across the documents in the result set. null
// for date fields.
Sum *float64 `locationName:"sum" type:"double"`
// The sum of all field values in the result set squared.
SumOfSquares *float64 `locationName:"sumOfSquares" type:"double"`
}
// String returns the string representation
func (s FieldStats) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s FieldStats) GoString() string {
return s.String()
}
// Information about a document that matches the search request.
type Hit struct {
_ struct{} `type:"structure"`
// The expressions returned from a document that matches the search request.
Exprs map[string]*string `locationName:"exprs" type:"map"`
// The fields returned from a document that matches the search request.
Fields map[string][]*string `locationName:"fields" type:"map"`
// The highlights returned from a document that matches the search request.
Highlights map[string]*string `locationName:"highlights" type:"map"`
// The document ID of a document that matches the search request.
Id *string `locationName:"id" type:"string"`
}
// String returns the string representation
func (s Hit) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s Hit) GoString() string {
return s.String()
}
// The collection of documents that match the search request.
type Hits struct {
_ struct{} `type:"structure"`
// A cursor that can be used to retrieve the next set of matching documents
// when you want to page through a large result set.
Cursor *string `locationName:"cursor" type:"string"`
// The total number of documents that match the search request.
Found *int64 `locationName:"found" type:"long"`
// A document that matches the search request.
Hit []*Hit `locationName:"hit" type:"list"`
// The index of the first matching document.
Start *int64 `locationName:"start" type:"long"`
}
// String returns the string representation
func (s Hits) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s Hits) GoString() string {
return s.String()
}
// Container for the parameters to the Search request.
type SearchInput struct {
_ struct{} `type:"structure"`
// Retrieves a cursor value you can use to page through large result sets. Use
// the size parameter to control the number of hits to include in each response.
// You can specify either the cursor or start parameter in a request; they are
// mutually exclusive. To get the first cursor, set the cursor value to initial.
// In subsequent requests, specify the cursor value returned in the hits section
// of the response.
//
// For more information, see Paginating Results (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/paginating-results.html)
// in the Amazon CloudSearch Developer Guide.
Cursor *string `location:"querystring" locationName:"cursor" type:"string"`
// Defines one or more numeric expressions that can be used to sort results
// or specify search or filter criteria. You can also specify expressions as
// return fields.
//
// You specify the expressions in JSON using the form {"EXPRESSIONNAME":"EXPRESSION"}.
// You can define and use multiple expressions in a search request. For example:
//
// {"expression1":"_score*rating", "expression2":"(1/rank)*year"}
//
// For information about the variables, operators, and functions you can use
// in expressions, see Writing Expressions (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-expressions.html#writing-expressions)
// in the Amazon CloudSearch Developer Guide.
Expr *string `location:"querystring" locationName:"expr" type:"string"`
// Specifies one or more fields for which to get facet information, and options
// that control how the facet information is returned. Each specified field
// must be facet-enabled in the domain configuration. The fields and options
// are specified in JSON using the form {"FIELD":{"OPTION":VALUE,"OPTION:"STRING"},"FIELD":{"OPTION":VALUE,"OPTION":"STRING"}}.
//
// You can specify the following faceting options:
//
// buckets specifies an array of the facet values or ranges to count. Ranges
// are specified using the same syntax that you use to search for a range of
// values. For more information, see Searching for a Range of Values (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-ranges.html)
// in the Amazon CloudSearch Developer Guide. Buckets are returned in the order
// they are specified in the request. The sort and size options are not valid
// if you specify buckets.
//
// size specifies the maximum number of facets to include in the results.
// By default, Amazon CloudSearch returns counts for the top 10. The size parameter
// is only valid when you specify the sort option; it cannot be used in conjunction
// with buckets.
//
// sort specifies how you want to sort the facets in the results: bucket
// or count. Specify bucket to sort alphabetically or numerically by facet value
// (in ascending order). Specify count to sort by the facet counts computed
// for each facet value (in descending order). To retrieve facet counts for
// particular values or ranges of values, use the buckets option instead of
// sort.
//
// If no facet options are specified, facet counts are computed for all field
// values, the facets are sorted by facet count, and the top 10 facets are returned
// in the results.
//
// To count particular buckets of values, use the buckets option. For example,
// the following request uses the buckets option to calculate and return facet
// counts by decade.
//
// {"year":{"buckets":["[1970,1979]","[1980,1989]","[1990,1999]","[2000,2009]","[2010,}"]}}
//
// To sort facets by facet count, use the count option. For example, the following
// request sets the sort option to count to sort the facet values by facet count,
// with the facet values that have the most matching documents listed first.
// Setting the size option to 3 returns only the top three facet values.
//
// {"year":{"sort":"count","size":3}}
//
// To sort the facets by value, use the bucket option. For example, the following
// request sets the sort option to bucket to sort the facet values numerically
// by year, with earliest year listed first.
//
// {"year":{"sort":"bucket"}}
//
// For more information, see Getting and Using Facet Information (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/faceting.html)
// in the Amazon CloudSearch Developer Guide.
Facet *string `location:"querystring" locationName:"facet" type:"string"`
// Specifies a structured query that filters the results of a search without
// affecting how the results are scored and sorted. You use filterQuery in conjunction
// with the query parameter to filter the documents that match the constraints
// specified in the query parameter. Specifying a filter controls only which
// matching documents are included in the results, it has no effect on how they
// are scored and sorted. The filterQuery parameter supports the full structured
// query syntax.
//
// For more information about using filters, see Filtering Matching Documents
// (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/filtering-results.html)
// in the Amazon CloudSearch Developer Guide.
FilterQuery *string `location:"querystring" locationName:"fq" type:"string"`
// Retrieves highlights for matches in the specified text or text-array fields.
// Each specified field must be highlight enabled in the domain configuration.
// The fields and options are specified in JSON using the form {"FIELD":{"OPTION":VALUE,"OPTION:"STRING"},"FIELD":{"OPTION":VALUE,"OPTION":"STRING"}}.
//
// You can specify the following highlight options:
//
// format: specifies the format of the data in the text field: text or html.
// When data is returned as HTML, all non-alphanumeric characters are encoded.
// The default is html. max_phrases: specifies the maximum number of occurrences
// of the search term(s) you want to highlight. By default, the first occurrence
// is highlighted. pre_tag: specifies the string to prepend to an occurrence
// of a search term. The default for HTML highlights is &lt;em&gt;. The default
// for text highlights is *. post_tag: specifies the string to append to an
// occurrence of a search term. The default for HTML highlights is &lt;/em&gt;.
// The default for text highlights is *. If no highlight options are specified
// for a field, the returned field text is treated as HTML and the first match
// is highlighted with emphasis tags: &lt;em>search-term&lt;/em&gt;.
//
// For example, the following request retrieves highlights for the actors and
// title fields.
//
// { "actors": {}, "title": {"format": "text","max_phrases": 2,"pre_tag":
// "","post_tag": ""} }
Highlight *string `location:"querystring" locationName:"highlight" type:"string"`
// Enables partial results to be returned if one or more index partitions are
// unavailable. When your search index is partitioned across multiple search
// instances, by default Amazon CloudSearch only returns results if every partition
// can be queried. This means that the failure of a single search instance can
// result in 5xx (internal server) errors. When you enable partial results,
// Amazon CloudSearch returns whatever results are available and includes the
// percentage of documents searched in the search results (percent-searched).
// This enables you to more gracefully degrade your users' search experience.
// For example, rather than displaying no results, you could display the partial
// results and a message indicating that the results might be incomplete due
// to a temporary system outage.
Partial *bool `location:"querystring" locationName:"partial" type:"boolean"`
// Specifies the search criteria for the request. How you specify the search
// criteria depends on the query parser used for the request and the parser
// options specified in the queryOptions parameter. By default, the simple query
// parser is used to process requests. To use the structured, lucene, or dismax
// query parser, you must also specify the queryParser parameter.
//
// For more information about specifying search criteria, see Searching Your
// Data (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching.html)
// in the Amazon CloudSearch Developer Guide.
Query *string `location:"querystring" locationName:"q" type:"string" required:"true"`
// Configures options for the query parser specified in the queryParser parameter.
// You specify the options in JSON using the following form {"OPTION1":"VALUE1","OPTION2":VALUE2"..."OPTIONN":"VALUEN"}.
//
// The options you can configure vary according to which parser you use:
//
// defaultOperator: The default operator used to combine individual terms
// in the search string. For example: defaultOperator: 'or'. For the dismax
// parser, you specify a percentage that represents the percentage of terms
// in the search string (rounded down) that must match, rather than a default
// operator. A value of 0% is the equivalent to OR, and a value of 100% is equivalent
// to AND. The percentage must be specified as a value in the range 0-100 followed
// by the percent (%) symbol. For example, defaultOperator: 50%. Valid values:
// and, or, a percentage in the range 0%-100% (dismax). Default: and (simple,
// structured, lucene) or 100 (dismax). Valid for: simple, structured, lucene,
// and dismax. fields: An array of the fields to search when no fields are specified
// in a search. If no fields are specified in a search and this option is not
// specified, all text and text-array fields are searched. You can specify a
// weight for each field to control the relative importance of each field when
// Amazon CloudSearch calculates relevance scores. To specify a field weight,
// append a caret (^) symbol and the weight to the field name. For example,
// to boost the importance of the title field over the description field you
// could specify: "fields":["title^5","description"]. Valid values: The name
// of any configured field and an optional numeric value greater than zero.
// Default: All text and text-array fields. Valid for: simple, structured, lucene,
// and dismax. operators: An array of the operators or special characters you
// want to disable for the simple query parser. If you disable the and, or,
// or not operators, the corresponding operators (+, |, -) have no special meaning
// and are dropped from the search string. Similarly, disabling prefix disables
// the wildcard operator (*) and disabling phrase disables the ability to search
// for phrases by enclosing phrases in double quotes. Disabling precedence disables
// the ability to control order of precedence using parentheses. Disabling near
// disables the ability to use the ~ operator to perform a sloppy phrase search.
// Disabling the fuzzy operator disables the ability to use the ~ operator to
// perform a fuzzy search. escape disables the ability to use a backslash (\)
// to escape special characters within the search string. Disabling whitespace
// is an advanced option that prevents the parser from tokenizing on whitespace,
// which can be useful for Vietnamese. (It prevents Vietnamese words from being
// split incorrectly.) For example, you could disable all operators other than
// the phrase operator to support just simple term and phrase queries: "operators":["and","not","or",
// "prefix"]. Valid values: and, escape, fuzzy, near, not, or, phrase, precedence,
// prefix, whitespace. Default: All operators and special characters are enabled.
// Valid for: simple. phraseFields: An array of the text or text-array fields
// you want to use for phrase searches. When the terms in the search string
// appear in close proximity within a field, the field scores higher. You can
// specify a weight for each field to boost that score. The phraseSlop option
// controls how much the matches can deviate from the search string and still
// be boosted. To specify a field weight, append a caret (^) symbol and the
// weight to the field name. For example, to boost phrase matches in the title
// field over the abstract field, you could specify: "phraseFields":["title^3",
// "plot"] Valid values: The name of any text or text-array field and an optional
// numeric value greater than zero. Default: No fields. If you don't specify
// any fields with phraseFields, proximity scoring is disabled even if phraseSlop
// is specified. Valid for: dismax. phraseSlop: An integer value that specifies
// how much matches can deviate from the search phrase and still be boosted
// according to the weights specified in the phraseFields option; for example,
// phraseSlop: 2. You must also specify phraseFields to enable proximity scoring.
// Valid values: positive integers. Default: 0. Valid for: dismax. explicitPhraseSlop:
// An integer value that specifies how much a match can deviate from the search
// phrase when the phrase is enclosed in double quotes in the search string.
// (Phrases that exceed this proximity distance are not considered a match.)
// For example, to specify a slop of three for dismax phrase queries, you would
// specify "explicitPhraseSlop":3. Valid values: positive integers. Default:
// 0. Valid for: dismax. tieBreaker: When a term in the search string is found
// in a document's field, a score is calculated for that field based on how
// common the word is in that field compared to other documents. If the term
// occurs in multiple fields within a document, by default only the highest
// scoring field contributes to the document's overall score. You can specify
// a tieBreaker value to enable the matches in lower-scoring fields to contribute
// to the document's score. That way, if two documents have the same max field
// score for a particular term, the score for the document that has matches
// in more fields will be higher. The formula for calculating the score with
// a tieBreaker is (max field score) + (tieBreaker) * (sum of the scores for
// the rest of the matching fields). Set tieBreaker to 0 to disregard all but
// the highest scoring field (pure max): "tieBreaker":0. Set to 1 to sum the
// scores from all fields (pure sum): "tieBreaker":1. Valid values: 0.0 to 1.0.
// Default: 0.0. Valid for: dismax.
QueryOptions *string `location:"querystring" locationName:"q.options" type:"string"`
// Specifies which query parser to use to process the request. If queryParser
// is not specified, Amazon CloudSearch uses the simple query parser.
//
// Amazon CloudSearch supports four query parsers:
//
// simple: perform simple searches of text and text-array fields. By default,
// the simple query parser searches all text and text-array fields. You can
// specify which fields to search by with the queryOptions parameter. If you
// prefix a search term with a plus sign (+) documents must contain the term
// to be considered a match. (This is the default, unless you configure the
// default operator with the queryOptions parameter.) You can use the - (NOT),
// | (OR), and * (wildcard) operators to exclude particular terms, find results
// that match any of the specified terms, or search for a prefix. To search
// for a phrase rather than individual terms, enclose the phrase in double quotes.
// For more information, see Searching for Text (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html)
// in the Amazon CloudSearch Developer Guide. structured: perform advanced
// searches by combining multiple expressions to define the search criteria.
// You can also search within particular fields, search for values and ranges
// of values, and use advanced options such as term boosting, matchall, and
// near. For more information, see Constructing Compound Queries (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-compound-queries.html)
// in the Amazon CloudSearch Developer Guide. lucene: search using the Apache
// Lucene query parser syntax. For more information, see Apache Lucene Query
// Parser Syntax (http://lucene.apache.org/core/4_6_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description).
// dismax: search using the simplified subset of the Apache Lucene query parser
// syntax defined by the DisMax query parser. For more information, see DisMax
// Query Parser Syntax (http://wiki.apache.org/solr/DisMaxQParserPlugin#Query_Syntax).
QueryParser *string `location:"querystring" locationName:"q.parser" type:"string" enum:"QueryParser"`
// Specifies the field and expression values to include in the response. Multiple
// fields or expressions are specified as a comma-separated list. By default,
// a search response includes all return enabled fields (_all_fields). To return
// only the document IDs for the matching documents, specify _no_fields. To
// retrieve the relevance score calculated for each document, specify _score.
Return *string `location:"querystring" locationName:"return" type:"string"`
// Specifies the maximum number of search hits to include in the response.
Size *int64 `location:"querystring" locationName:"size" type:"long"`
// Specifies the fields or custom expressions to use to sort the search results.
// Multiple fields or expressions are specified as a comma-separated list. You
// must specify the sort direction (asc or desc) for each field; for example,
// year desc,title asc. To use a field to sort results, the field must be sort-enabled
// in the domain configuration. Array type fields cannot be used for sorting.
// If no sort parameter is specified, results are sorted by their default relevance
// scores in descending order: _score desc. You can also sort by document ID
// (_id asc) and version (_version desc).
//
// For more information, see Sorting Results (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/sorting-results.html)
// in the Amazon CloudSearch Developer Guide.
Sort *string `location:"querystring" locationName:"sort" type:"string"`
// Specifies the offset of the first search hit you want to return. Note that
// the result set is zero-based; the first result is at index 0. You can specify
// either the start or cursor parameter in a request, they are mutually exclusive.
//
// For more information, see Paginating Results (http://docs.aws.amazon.com/cloudsearch/latest/developerguide/paginating-results.html)
// in the Amazon CloudSearch Developer Guide.
Start *int64 `location:"querystring" locationName:"start" type:"long"`
// Specifies one or more fields for which to get statistics information. Each
// specified field must be facet-enabled in the domain configuration. The fields
// are specified in JSON using the form:
//
// {"FIELD-A":{},"FIELD-B":{}} There are currently no options supported for
// statistics.
Stats *string `location:"querystring" locationName:"stats" type:"string"`
}
// String returns the string representation
func (s SearchInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SearchInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *SearchInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "SearchInput"}
if s.Query == nil {
invalidParams.Add(request.NewErrParamRequired("Query"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// The result of a Search request. Contains the documents that match the specified
// search criteria and any requested fields, highlights, and facet information.
type SearchOutput struct {
_ struct{} `type:"structure"`
// The requested facet information.
Facets map[string]*BucketInfo `locationName:"facets" type:"map"`
// The documents that match the search criteria.
Hits *Hits `locationName:"hits" type:"structure"`
// The requested field statistics information.
Stats map[string]*FieldStats `locationName:"stats" type:"map"`
// The status information returned for the search request.
Status *SearchStatus `locationName:"status" type:"structure"`
}
// String returns the string representation
func (s SearchOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SearchOutput) GoString() string {
return s.String()
}
// Contains the resource id (rid) and the time it took to process the request
// (timems).
type SearchStatus struct {
_ struct{} `type:"structure"`
// The encrypted resource ID for the request.
Rid *string `locationName:"rid" type:"string"`
// How long it took to process the request, in milliseconds.
Timems *int64 `locationName:"timems" type:"long"`
}
// String returns the string representation
func (s SearchStatus) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SearchStatus) GoString() string {
return s.String()
}
// Container for the parameters to the Suggest request.
type SuggestInput struct {
_ struct{} `type:"structure"`
// Specifies the string for which you want to get suggestions.
Query *string `location:"querystring" locationName:"q" type:"string" required:"true"`
// Specifies the maximum number of suggestions to return.
Size *int64 `location:"querystring" locationName:"size" type:"long"`
// Specifies the name of the suggester to use to find suggested matches.
Suggester *string `location:"querystring" locationName:"suggester" type:"string" required:"true"`
}
// String returns the string representation
func (s SuggestInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SuggestInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *SuggestInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "SuggestInput"}
if s.Query == nil {
invalidParams.Add(request.NewErrParamRequired("Query"))
}
if s.Suggester == nil {
invalidParams.Add(request.NewErrParamRequired("Suggester"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// Container for the suggestion information returned in a SuggestResponse.
type SuggestModel struct {
_ struct{} `type:"structure"`
// The number of documents that were found to match the query string.
Found *int64 `locationName:"found" type:"long"`
// The query string specified in the suggest request.
Query *string `locationName:"query" type:"string"`
// The documents that match the query string.
Suggestions []*SuggestionMatch `locationName:"suggestions" type:"list"`
}
// String returns the string representation
func (s SuggestModel) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SuggestModel) GoString() string {
return s.String()
}
// Contains the response to a Suggest request.
type SuggestOutput struct {
_ struct{} `type:"structure"`
// The status of a SuggestRequest. Contains the resource ID (rid) and how long
// it took to process the request (timems).
Status *SuggestStatus `locationName:"status" type:"structure"`
// Container for the matching search suggestion information.
Suggest *SuggestModel `locationName:"suggest" type:"structure"`
}
// String returns the string representation
func (s SuggestOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SuggestOutput) GoString() string {
return s.String()
}
// Contains the resource id (rid) and the time it took to process the request
// (timems).
type SuggestStatus struct {
_ struct{} `type:"structure"`
// The encrypted resource ID for the request.
Rid *string `locationName:"rid" type:"string"`
// How long it took to process the request, in milliseconds.
Timems *int64 `locationName:"timems" type:"long"`
}
// String returns the string representation
func (s SuggestStatus) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SuggestStatus) GoString() string {
return s.String()
}
// An autocomplete suggestion that matches the query string specified in a SuggestRequest.
type SuggestionMatch struct {
_ struct{} `type:"structure"`
// The document ID of the suggested document.
Id *string `locationName:"id" type:"string"`
// The relevance score of a suggested match.
Score *int64 `locationName:"score" type:"long"`
// The string that matches the query string specified in the SuggestRequest.
Suggestion *string `locationName:"suggestion" type:"string"`
}
// String returns the string representation
func (s SuggestionMatch) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s SuggestionMatch) GoString() string {
return s.String()
}
// Container for the parameters to the UploadDocuments request.
type UploadDocumentsInput struct {
_ struct{} `type:"structure" payload:"Documents"`
// The format of the batch you are uploading. Amazon CloudSearch supports two
// document batch formats:
//
// application/json application/xml
ContentType *string `location:"header" locationName:"Content-Type" type:"string" required:"true" enum:"ContentType"`
// A batch of documents formatted in JSON or HTML.
Documents io.ReadSeeker `locationName:"documents" type:"blob" required:"true"`
}
// String returns the string representation
func (s UploadDocumentsInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s UploadDocumentsInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *UploadDocumentsInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "UploadDocumentsInput"}
if s.ContentType == nil {
invalidParams.Add(request.NewErrParamRequired("ContentType"))
}
if s.Documents == nil {
invalidParams.Add(request.NewErrParamRequired("Documents"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// Contains the response to an UploadDocuments request.
type UploadDocumentsOutput struct {
_ struct{} `type:"structure"`
// The number of documents that were added to the search domain.
Adds *int64 `locationName:"adds" type:"long"`
// The number of documents that were deleted from the search domain.
Deletes *int64 `locationName:"deletes" type:"long"`
// The status of an UploadDocumentsRequest.
Status *string `locationName:"status" type:"string"`
// Any warnings returned by the document service about the documents being uploaded.
Warnings []*DocumentServiceWarning `locationName:"warnings" type:"list"`
}
// String returns the string representation
func (s UploadDocumentsOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s UploadDocumentsOutput) GoString() string {
return s.String()
}
const (
// @enum ContentType
ContentTypeApplicationJson = "application/json"
// @enum ContentType
ContentTypeApplicationXml = "application/xml"
)
const (
// @enum QueryParser
QueryParserSimple = "simple"
// @enum QueryParser
QueryParserStructured = "structured"
// @enum QueryParser
QueryParserLucene = "lucene"
// @enum QueryParser
QueryParserDismax = "dismax"
)

View File

@@ -1,26 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudsearchdomainiface provides an interface for the Amazon CloudSearch Domain.
package cloudsearchdomainiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudsearchdomain"
)
// CloudSearchDomainAPI is the interface type for cloudsearchdomain.CloudSearchDomain.
type CloudSearchDomainAPI interface {
SearchRequest(*cloudsearchdomain.SearchInput) (*request.Request, *cloudsearchdomain.SearchOutput)
Search(*cloudsearchdomain.SearchInput) (*cloudsearchdomain.SearchOutput, error)
SuggestRequest(*cloudsearchdomain.SuggestInput) (*request.Request, *cloudsearchdomain.SuggestOutput)
Suggest(*cloudsearchdomain.SuggestInput) (*cloudsearchdomain.SuggestOutput, error)
UploadDocumentsRequest(*cloudsearchdomain.UploadDocumentsInput) (*request.Request, *cloudsearchdomain.UploadDocumentsOutput)
UploadDocuments(*cloudsearchdomain.UploadDocumentsInput) (*cloudsearchdomain.UploadDocumentsOutput, error)
}
var _ CloudSearchDomainAPI = (*cloudsearchdomain.CloudSearchDomain)(nil)

View File

@@ -1,50 +0,0 @@
package cloudsearchdomain_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/cloudsearchdomain"
)
func TestRequireEndpointIfRegionProvided(t *testing.T) {
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
Region: aws.String("mock-region"),
DisableParamValidation: aws.Bool(true),
})
req, _ := svc.SearchRequest(nil)
err := req.Build()
assert.Equal(t, "", svc.Endpoint)
assert.Error(t, err)
assert.Equal(t, aws.ErrMissingEndpoint, err)
}
func TestRequireEndpointIfNoRegionProvided(t *testing.T) {
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
Region: aws.String(""),
DisableParamValidation: aws.Bool(true),
})
req, _ := svc.SearchRequest(nil)
err := req.Build()
assert.Equal(t, "", svc.Endpoint)
assert.Error(t, err)
assert.Equal(t, aws.ErrMissingEndpoint, err)
}
func TestRequireEndpointUsed(t *testing.T) {
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
Region: aws.String("mock-region"),
DisableParamValidation: aws.Bool(true),
Endpoint: aws.String("https://endpoint"),
})
req, _ := svc.SearchRequest(nil)
err := req.Build()
assert.Equal(t, "https://endpoint", svc.Endpoint)
assert.NoError(t, err)
}

View File

@@ -1,89 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudsearchdomain_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudsearchdomain"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudSearchDomain_Search() {
svc := cloudsearchdomain.New(session.New())
params := &cloudsearchdomain.SearchInput{
Query: aws.String("Query"), // Required
Cursor: aws.String("Cursor"),
Expr: aws.String("Expr"),
Facet: aws.String("Facet"),
FilterQuery: aws.String("FilterQuery"),
Highlight: aws.String("Highlight"),
Partial: aws.Bool(true),
QueryOptions: aws.String("QueryOptions"),
QueryParser: aws.String("QueryParser"),
Return: aws.String("Return"),
Size: aws.Int64(1),
Sort: aws.String("Sort"),
Start: aws.Int64(1),
Stats: aws.String("Stat"),
}
resp, err := svc.Search(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearchDomain_Suggest() {
svc := cloudsearchdomain.New(session.New())
params := &cloudsearchdomain.SuggestInput{
Query: aws.String("Query"), // Required
Suggester: aws.String("Suggester"), // Required
Size: aws.Int64(1),
}
resp, err := svc.Suggest(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudSearchDomain_UploadDocuments() {
svc := cloudsearchdomain.New(session.New())
params := &cloudsearchdomain.UploadDocumentsInput{
ContentType: aws.String("ContentType"), // Required
Documents: bytes.NewReader([]byte("PAYLOAD")), // Required
}
resp, err := svc.UploadDocuments(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,96 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudsearchdomain
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// You use the AmazonCloudSearch2013 API to upload documents to a search domain
// and search those documents.
//
// The endpoints for submitting UploadDocuments, Search, and Suggest requests
// are domain-specific. To get the endpoints for your domain, use the Amazon
// CloudSearch configuration service DescribeDomains action. The domain endpoints
// are also displayed on the domain dashboard in the Amazon CloudSearch console.
// You submit suggest requests to the search endpoint.
//
// For more information, see the Amazon CloudSearch Developer Guide (http://docs.aws.amazon.com/cloudsearch/latest/developerguide).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudSearchDomain struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cloudsearchdomain"
// New creates a new instance of the CloudSearchDomain client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudSearchDomain client from just a session.
// svc := cloudsearchdomain.New(mySession)
//
// // Create a CloudSearchDomain client with additional configuration
// svc := cloudsearchdomain.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudSearchDomain {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudSearchDomain {
svc := &CloudSearchDomain{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: "cloudsearch",
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2013-01-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudSearchDomain operation and runs any
// custom request initialization.
func (c *CloudSearchDomain) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,62 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudtrailiface provides an interface for the AWS CloudTrail.
package cloudtrailiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudtrail"
)
// CloudTrailAPI is the interface type for cloudtrail.CloudTrail.
type CloudTrailAPI interface {
AddTagsRequest(*cloudtrail.AddTagsInput) (*request.Request, *cloudtrail.AddTagsOutput)
AddTags(*cloudtrail.AddTagsInput) (*cloudtrail.AddTagsOutput, error)
CreateTrailRequest(*cloudtrail.CreateTrailInput) (*request.Request, *cloudtrail.CreateTrailOutput)
CreateTrail(*cloudtrail.CreateTrailInput) (*cloudtrail.CreateTrailOutput, error)
DeleteTrailRequest(*cloudtrail.DeleteTrailInput) (*request.Request, *cloudtrail.DeleteTrailOutput)
DeleteTrail(*cloudtrail.DeleteTrailInput) (*cloudtrail.DeleteTrailOutput, error)
DescribeTrailsRequest(*cloudtrail.DescribeTrailsInput) (*request.Request, *cloudtrail.DescribeTrailsOutput)
DescribeTrails(*cloudtrail.DescribeTrailsInput) (*cloudtrail.DescribeTrailsOutput, error)
GetTrailStatusRequest(*cloudtrail.GetTrailStatusInput) (*request.Request, *cloudtrail.GetTrailStatusOutput)
GetTrailStatus(*cloudtrail.GetTrailStatusInput) (*cloudtrail.GetTrailStatusOutput, error)
ListPublicKeysRequest(*cloudtrail.ListPublicKeysInput) (*request.Request, *cloudtrail.ListPublicKeysOutput)
ListPublicKeys(*cloudtrail.ListPublicKeysInput) (*cloudtrail.ListPublicKeysOutput, error)
ListTagsRequest(*cloudtrail.ListTagsInput) (*request.Request, *cloudtrail.ListTagsOutput)
ListTags(*cloudtrail.ListTagsInput) (*cloudtrail.ListTagsOutput, error)
LookupEventsRequest(*cloudtrail.LookupEventsInput) (*request.Request, *cloudtrail.LookupEventsOutput)
LookupEvents(*cloudtrail.LookupEventsInput) (*cloudtrail.LookupEventsOutput, error)
RemoveTagsRequest(*cloudtrail.RemoveTagsInput) (*request.Request, *cloudtrail.RemoveTagsOutput)
RemoveTags(*cloudtrail.RemoveTagsInput) (*cloudtrail.RemoveTagsOutput, error)
StartLoggingRequest(*cloudtrail.StartLoggingInput) (*request.Request, *cloudtrail.StartLoggingOutput)
StartLogging(*cloudtrail.StartLoggingInput) (*cloudtrail.StartLoggingOutput, error)
StopLoggingRequest(*cloudtrail.StopLoggingInput) (*request.Request, *cloudtrail.StopLoggingOutput)
StopLogging(*cloudtrail.StopLoggingInput) (*cloudtrail.StopLoggingOutput, error)
UpdateTrailRequest(*cloudtrail.UpdateTrailInput) (*request.Request, *cloudtrail.UpdateTrailOutput)
UpdateTrail(*cloudtrail.UpdateTrailInput) (*cloudtrail.UpdateTrailOutput, error)
}
var _ CloudTrailAPI = (*cloudtrail.CloudTrail)(nil)

View File

@@ -1,296 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudtrail_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudtrail"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudTrail_AddTags() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.AddTagsInput{
ResourceId: aws.String("String"), // Required
TagsList: []*cloudtrail.Tag{
{ // Required
Key: aws.String("String"), // Required
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.AddTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_CreateTrail() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.CreateTrailInput{
Name: aws.String("String"), // Required
S3BucketName: aws.String("String"), // Required
CloudWatchLogsLogGroupArn: aws.String("String"),
CloudWatchLogsRoleArn: aws.String("String"),
EnableLogFileValidation: aws.Bool(true),
IncludeGlobalServiceEvents: aws.Bool(true),
IsMultiRegionTrail: aws.Bool(true),
KmsKeyId: aws.String("String"),
S3KeyPrefix: aws.String("String"),
SnsTopicName: aws.String("String"),
}
resp, err := svc.CreateTrail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_DeleteTrail() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.DeleteTrailInput{
Name: aws.String("String"), // Required
}
resp, err := svc.DeleteTrail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_DescribeTrails() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.DescribeTrailsInput{
IncludeShadowTrails: aws.Bool(true),
TrailNameList: []*string{
aws.String("String"), // Required
// More values...
},
}
resp, err := svc.DescribeTrails(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_GetTrailStatus() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.GetTrailStatusInput{
Name: aws.String("String"), // Required
}
resp, err := svc.GetTrailStatus(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_ListPublicKeys() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.ListPublicKeysInput{
EndTime: aws.Time(time.Now()),
NextToken: aws.String("String"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.ListPublicKeys(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_ListTags() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.ListTagsInput{
ResourceIdList: []*string{ // Required
aws.String("String"), // Required
// More values...
},
NextToken: aws.String("String"),
}
resp, err := svc.ListTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_LookupEvents() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.LookupEventsInput{
EndTime: aws.Time(time.Now()),
LookupAttributes: []*cloudtrail.LookupAttribute{
{ // Required
AttributeKey: aws.String("LookupAttributeKey"), // Required
AttributeValue: aws.String("String"), // Required
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
StartTime: aws.Time(time.Now()),
}
resp, err := svc.LookupEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_RemoveTags() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.RemoveTagsInput{
ResourceId: aws.String("String"), // Required
TagsList: []*cloudtrail.Tag{
{ // Required
Key: aws.String("String"), // Required
Value: aws.String("String"),
},
// More values...
},
}
resp, err := svc.RemoveTags(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_StartLogging() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.StartLoggingInput{
Name: aws.String("String"), // Required
}
resp, err := svc.StartLogging(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_StopLogging() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.StopLoggingInput{
Name: aws.String("String"), // Required
}
resp, err := svc.StopLogging(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudTrail_UpdateTrail() {
svc := cloudtrail.New(session.New())
params := &cloudtrail.UpdateTrailInput{
Name: aws.String("String"), // Required
CloudWatchLogsLogGroupArn: aws.String("String"),
CloudWatchLogsRoleArn: aws.String("String"),
EnableLogFileValidation: aws.Bool(true),
IncludeGlobalServiceEvents: aws.Bool(true),
IsMultiRegionTrail: aws.Bool(true),
KmsKeyId: aws.String("String"),
S3BucketName: aws.String("String"),
S3KeyPrefix: aws.String("String"),
SnsTopicName: aws.String("String"),
}
resp, err := svc.UpdateTrail(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,107 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudtrail
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// This is the CloudTrail API Reference. It provides descriptions of actions,
// data types, common parameters, and common errors for CloudTrail.
//
// CloudTrail is a web service that records AWS API calls for your AWS account
// and delivers log files to an Amazon S3 bucket. The recorded information includes
// the identity of the user, the start time of the AWS API call, the source
// IP address, the request parameters, and the response elements returned by
// the service.
//
// As an alternative to the API, you can use one of the AWS SDKs, which consist
// of libraries and sample code for various programming languages and platforms
// (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient way
// to create programmatic access to AWSCloudTrail. For example, the SDKs take
// care of cryptographically signing requests, managing errors, and retrying
// requests automatically. For information about the AWS SDKs, including how
// to download and install them, see the Tools for Amazon Web Services page
// (http://aws.amazon.com/tools/).
//
// See the CloudTrail User Guide for information about the data that is included
// with each AWS API call listed in the log files.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudTrail struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cloudtrail"
// New creates a new instance of the CloudTrail client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudTrail client from just a session.
// svc := cloudtrail.New(mySession)
//
// // Create a CloudTrail client with additional configuration
// svc := cloudtrail.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudTrail {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudTrail {
svc := &CloudTrail{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2013-11-01",
JSONVersion: "1.1",
TargetPrefix: "com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudTrail operation and runs any
// custom request initialization.
func (c *CloudTrail) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,64 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudwatchiface provides an interface for the Amazon CloudWatch.
package cloudwatchiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudwatch"
)
// CloudWatchAPI is the interface type for cloudwatch.CloudWatch.
type CloudWatchAPI interface {
DeleteAlarmsRequest(*cloudwatch.DeleteAlarmsInput) (*request.Request, *cloudwatch.DeleteAlarmsOutput)
DeleteAlarms(*cloudwatch.DeleteAlarmsInput) (*cloudwatch.DeleteAlarmsOutput, error)
DescribeAlarmHistoryRequest(*cloudwatch.DescribeAlarmHistoryInput) (*request.Request, *cloudwatch.DescribeAlarmHistoryOutput)
DescribeAlarmHistory(*cloudwatch.DescribeAlarmHistoryInput) (*cloudwatch.DescribeAlarmHistoryOutput, error)
DescribeAlarmHistoryPages(*cloudwatch.DescribeAlarmHistoryInput, func(*cloudwatch.DescribeAlarmHistoryOutput, bool) bool) error
DescribeAlarmsRequest(*cloudwatch.DescribeAlarmsInput) (*request.Request, *cloudwatch.DescribeAlarmsOutput)
DescribeAlarms(*cloudwatch.DescribeAlarmsInput) (*cloudwatch.DescribeAlarmsOutput, error)
DescribeAlarmsPages(*cloudwatch.DescribeAlarmsInput, func(*cloudwatch.DescribeAlarmsOutput, bool) bool) error
DescribeAlarmsForMetricRequest(*cloudwatch.DescribeAlarmsForMetricInput) (*request.Request, *cloudwatch.DescribeAlarmsForMetricOutput)
DescribeAlarmsForMetric(*cloudwatch.DescribeAlarmsForMetricInput) (*cloudwatch.DescribeAlarmsForMetricOutput, error)
DisableAlarmActionsRequest(*cloudwatch.DisableAlarmActionsInput) (*request.Request, *cloudwatch.DisableAlarmActionsOutput)
DisableAlarmActions(*cloudwatch.DisableAlarmActionsInput) (*cloudwatch.DisableAlarmActionsOutput, error)
EnableAlarmActionsRequest(*cloudwatch.EnableAlarmActionsInput) (*request.Request, *cloudwatch.EnableAlarmActionsOutput)
EnableAlarmActions(*cloudwatch.EnableAlarmActionsInput) (*cloudwatch.EnableAlarmActionsOutput, error)
GetMetricStatisticsRequest(*cloudwatch.GetMetricStatisticsInput) (*request.Request, *cloudwatch.GetMetricStatisticsOutput)
GetMetricStatistics(*cloudwatch.GetMetricStatisticsInput) (*cloudwatch.GetMetricStatisticsOutput, error)
ListMetricsRequest(*cloudwatch.ListMetricsInput) (*request.Request, *cloudwatch.ListMetricsOutput)
ListMetrics(*cloudwatch.ListMetricsInput) (*cloudwatch.ListMetricsOutput, error)
ListMetricsPages(*cloudwatch.ListMetricsInput, func(*cloudwatch.ListMetricsOutput, bool) bool) error
PutMetricAlarmRequest(*cloudwatch.PutMetricAlarmInput) (*request.Request, *cloudwatch.PutMetricAlarmOutput)
PutMetricAlarm(*cloudwatch.PutMetricAlarmInput) (*cloudwatch.PutMetricAlarmOutput, error)
PutMetricDataRequest(*cloudwatch.PutMetricDataInput) (*request.Request, *cloudwatch.PutMetricDataOutput)
PutMetricData(*cloudwatch.PutMetricDataInput) (*cloudwatch.PutMetricDataOutput, error)
SetAlarmStateRequest(*cloudwatch.SetAlarmStateInput) (*request.Request, *cloudwatch.SetAlarmStateOutput)
SetAlarmState(*cloudwatch.SetAlarmStateInput) (*cloudwatch.SetAlarmStateOutput, error)
}
var _ CloudWatchAPI = (*cloudwatch.CloudWatch)(nil)

View File

@@ -1,337 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatch_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudWatch_DeleteAlarms() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.DeleteAlarmsInput{
AlarmNames: []*string{ // Required
aws.String("AlarmName"), // Required
// More values...
},
}
resp, err := svc.DeleteAlarms(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_DescribeAlarmHistory() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.DescribeAlarmHistoryInput{
AlarmName: aws.String("AlarmName"),
EndDate: aws.Time(time.Now()),
HistoryItemType: aws.String("HistoryItemType"),
MaxRecords: aws.Int64(1),
NextToken: aws.String("NextToken"),
StartDate: aws.Time(time.Now()),
}
resp, err := svc.DescribeAlarmHistory(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_DescribeAlarms() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.DescribeAlarmsInput{
ActionPrefix: aws.String("ActionPrefix"),
AlarmNamePrefix: aws.String("AlarmNamePrefix"),
AlarmNames: []*string{
aws.String("AlarmName"), // Required
// More values...
},
MaxRecords: aws.Int64(1),
NextToken: aws.String("NextToken"),
StateValue: aws.String("StateValue"),
}
resp, err := svc.DescribeAlarms(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_DescribeAlarmsForMetric() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.DescribeAlarmsForMetricInput{
MetricName: aws.String("MetricName"), // Required
Namespace: aws.String("Namespace"), // Required
Dimensions: []*cloudwatch.Dimension{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"), // Required
},
// More values...
},
Period: aws.Int64(1),
Statistic: aws.String("Statistic"),
Unit: aws.String("StandardUnit"),
}
resp, err := svc.DescribeAlarmsForMetric(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_DisableAlarmActions() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.DisableAlarmActionsInput{
AlarmNames: []*string{ // Required
aws.String("AlarmName"), // Required
// More values...
},
}
resp, err := svc.DisableAlarmActions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_EnableAlarmActions() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.EnableAlarmActionsInput{
AlarmNames: []*string{ // Required
aws.String("AlarmName"), // Required
// More values...
},
}
resp, err := svc.EnableAlarmActions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_GetMetricStatistics() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.GetMetricStatisticsInput{
EndTime: aws.Time(time.Now()), // Required
MetricName: aws.String("MetricName"), // Required
Namespace: aws.String("Namespace"), // Required
Period: aws.Int64(1), // Required
StartTime: aws.Time(time.Now()), // Required
Statistics: []*string{ // Required
aws.String("Statistic"), // Required
// More values...
},
Dimensions: []*cloudwatch.Dimension{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"), // Required
},
// More values...
},
Unit: aws.String("StandardUnit"),
}
resp, err := svc.GetMetricStatistics(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_ListMetrics() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.ListMetricsInput{
Dimensions: []*cloudwatch.DimensionFilter{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"),
},
// More values...
},
MetricName: aws.String("MetricName"),
Namespace: aws.String("Namespace"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListMetrics(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_PutMetricAlarm() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.PutMetricAlarmInput{
AlarmName: aws.String("AlarmName"), // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
EvaluationPeriods: aws.Int64(1), // Required
MetricName: aws.String("MetricName"), // Required
Namespace: aws.String("Namespace"), // Required
Period: aws.Int64(1), // Required
Statistic: aws.String("Statistic"), // Required
Threshold: aws.Float64(1.0), // Required
ActionsEnabled: aws.Bool(true),
AlarmActions: []*string{
aws.String("ResourceName"), // Required
// More values...
},
AlarmDescription: aws.String("AlarmDescription"),
Dimensions: []*cloudwatch.Dimension{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"), // Required
},
// More values...
},
InsufficientDataActions: []*string{
aws.String("ResourceName"), // Required
// More values...
},
OKActions: []*string{
aws.String("ResourceName"), // Required
// More values...
},
Unit: aws.String("StandardUnit"),
}
resp, err := svc.PutMetricAlarm(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_PutMetricData() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{ // Required
{ // Required
MetricName: aws.String("MetricName"), // Required
Dimensions: []*cloudwatch.Dimension{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"), // Required
},
// More values...
},
StatisticValues: &cloudwatch.StatisticSet{
Maximum: aws.Float64(1.0), // Required
Minimum: aws.Float64(1.0), // Required
SampleCount: aws.Float64(1.0), // Required
Sum: aws.Float64(1.0), // Required
},
Timestamp: aws.Time(time.Now()),
Unit: aws.String("StandardUnit"),
Value: aws.Float64(1.0),
},
// More values...
},
Namespace: aws.String("Namespace"), // Required
}
resp, err := svc.PutMetricData(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatch_SetAlarmState() {
svc := cloudwatch.New(session.New())
params := &cloudwatch.SetAlarmStateInput{
AlarmName: aws.String("AlarmName"), // Required
StateReason: aws.String("StateReason"), // Required
StateValue: aws.String("StateValue"), // Required
StateReasonData: aws.String("StateReasonData"),
}
resp, err := svc.SetAlarmState(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,100 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatch
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// Amazon CloudWatch monitors your Amazon Web Services (AWS) resources and the
// applications you run on AWS in real-time. You can use CloudWatch to collect
// and track metrics, which are the variables you want to measure for your resources
// and applications.
//
// CloudWatch alarms send notifications or automatically make changes to the
// resources you are monitoring based on rules that you define. For example,
// you can monitor the CPU usage and disk reads and writes of your Amazon Elastic
// Compute Cloud (Amazon EC2) instances and then use this data to determine
// whether you should launch additional instances to handle increased load.
// You can also use this data to stop under-used instances to save money.
//
// In addition to monitoring the built-in metrics that come with AWS, you can
// monitor your own custom metrics. With CloudWatch, you gain system-wide visibility
// into resource utilization, application performance, and operational health.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudWatch struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "monitoring"
// New creates a new instance of the CloudWatch client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudWatch client from just a session.
// svc := cloudwatch.New(mySession)
//
// // Create a CloudWatch client with additional configuration
// svc := cloudwatch.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatch {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudWatch {
svc := &CloudWatch{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2010-08-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudWatch operation and runs any
// custom request initialization.
func (c *CloudWatch) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

View File

@@ -1,30 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatch
import (
"github.com/aws/aws-sdk-go/private/waiter"
)
func (c *CloudWatch) WaitUntilAlarmExists(input *DescribeAlarmsInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeAlarms",
Delay: 5,
MaxAttempts: 40,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "length(MetricAlarms[]) > `0`",
Expected: true,
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,62 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudwatcheventsiface provides an interface for the Amazon CloudWatch Events.
package cloudwatcheventsiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
// CloudWatchEventsAPI is the interface type for cloudwatchevents.CloudWatchEvents.
type CloudWatchEventsAPI interface {
DeleteRuleRequest(*cloudwatchevents.DeleteRuleInput) (*request.Request, *cloudwatchevents.DeleteRuleOutput)
DeleteRule(*cloudwatchevents.DeleteRuleInput) (*cloudwatchevents.DeleteRuleOutput, error)
DescribeRuleRequest(*cloudwatchevents.DescribeRuleInput) (*request.Request, *cloudwatchevents.DescribeRuleOutput)
DescribeRule(*cloudwatchevents.DescribeRuleInput) (*cloudwatchevents.DescribeRuleOutput, error)
DisableRuleRequest(*cloudwatchevents.DisableRuleInput) (*request.Request, *cloudwatchevents.DisableRuleOutput)
DisableRule(*cloudwatchevents.DisableRuleInput) (*cloudwatchevents.DisableRuleOutput, error)
EnableRuleRequest(*cloudwatchevents.EnableRuleInput) (*request.Request, *cloudwatchevents.EnableRuleOutput)
EnableRule(*cloudwatchevents.EnableRuleInput) (*cloudwatchevents.EnableRuleOutput, error)
ListRuleNamesByTargetRequest(*cloudwatchevents.ListRuleNamesByTargetInput) (*request.Request, *cloudwatchevents.ListRuleNamesByTargetOutput)
ListRuleNamesByTarget(*cloudwatchevents.ListRuleNamesByTargetInput) (*cloudwatchevents.ListRuleNamesByTargetOutput, error)
ListRulesRequest(*cloudwatchevents.ListRulesInput) (*request.Request, *cloudwatchevents.ListRulesOutput)
ListRules(*cloudwatchevents.ListRulesInput) (*cloudwatchevents.ListRulesOutput, error)
ListTargetsByRuleRequest(*cloudwatchevents.ListTargetsByRuleInput) (*request.Request, *cloudwatchevents.ListTargetsByRuleOutput)
ListTargetsByRule(*cloudwatchevents.ListTargetsByRuleInput) (*cloudwatchevents.ListTargetsByRuleOutput, error)
PutEventsRequest(*cloudwatchevents.PutEventsInput) (*request.Request, *cloudwatchevents.PutEventsOutput)
PutEvents(*cloudwatchevents.PutEventsInput) (*cloudwatchevents.PutEventsOutput, error)
PutRuleRequest(*cloudwatchevents.PutRuleInput) (*request.Request, *cloudwatchevents.PutRuleOutput)
PutRule(*cloudwatchevents.PutRuleInput) (*cloudwatchevents.PutRuleOutput, error)
PutTargetsRequest(*cloudwatchevents.PutTargetsInput) (*request.Request, *cloudwatchevents.PutTargetsOutput)
PutTargets(*cloudwatchevents.PutTargetsInput) (*cloudwatchevents.PutTargetsOutput, error)
RemoveTargetsRequest(*cloudwatchevents.RemoveTargetsInput) (*request.Request, *cloudwatchevents.RemoveTargetsOutput)
RemoveTargets(*cloudwatchevents.RemoveTargetsInput) (*cloudwatchevents.RemoveTargetsOutput, error)
TestEventPatternRequest(*cloudwatchevents.TestEventPatternInput) (*request.Request, *cloudwatchevents.TestEventPatternOutput)
TestEventPattern(*cloudwatchevents.TestEventPatternInput) (*cloudwatchevents.TestEventPatternOutput, error)
}
var _ CloudWatchEventsAPI = (*cloudwatchevents.CloudWatchEvents)(nil)

View File

@@ -1,281 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatchevents_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudWatchEvents_DeleteRule() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.DeleteRuleInput{
Name: aws.String("RuleName"), // Required
}
resp, err := svc.DeleteRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_DescribeRule() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.DescribeRuleInput{
Name: aws.String("RuleName"), // Required
}
resp, err := svc.DescribeRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_DisableRule() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.DisableRuleInput{
Name: aws.String("RuleName"), // Required
}
resp, err := svc.DisableRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_EnableRule() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.EnableRuleInput{
Name: aws.String("RuleName"), // Required
}
resp, err := svc.EnableRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_ListRuleNamesByTarget() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.ListRuleNamesByTargetInput{
TargetArn: aws.String("TargetArn"), // Required
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListRuleNamesByTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_ListRules() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.ListRulesInput{
Limit: aws.Int64(1),
NamePrefix: aws.String("RuleName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListRules(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_ListTargetsByRule() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.ListTargetsByRuleInput{
Rule: aws.String("RuleName"), // Required
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListTargetsByRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_PutEvents() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.PutEventsInput{
Entries: []*cloudwatchevents.PutEventsRequestEntry{ // Required
{ // Required
Detail: aws.String("String"),
DetailType: aws.String("String"),
Resources: []*string{
aws.String("EventResource"), // Required
// More values...
},
Source: aws.String("String"),
Time: aws.Time(time.Now()),
},
// More values...
},
}
resp, err := svc.PutEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_PutRule() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.PutRuleInput{
Name: aws.String("RuleName"), // Required
Description: aws.String("RuleDescription"),
EventPattern: aws.String("EventPattern"),
RoleArn: aws.String("RoleArn"),
ScheduleExpression: aws.String("ScheduleExpression"),
State: aws.String("RuleState"),
}
resp, err := svc.PutRule(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_PutTargets() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.PutTargetsInput{
Rule: aws.String("RuleName"), // Required
Targets: []*cloudwatchevents.Target{ // Required
{ // Required
Arn: aws.String("TargetArn"), // Required
Id: aws.String("TargetId"), // Required
Input: aws.String("TargetInput"),
InputPath: aws.String("TargetInputPath"),
},
// More values...
},
}
resp, err := svc.PutTargets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_RemoveTargets() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.RemoveTargetsInput{
Ids: []*string{ // Required
aws.String("TargetId"), // Required
// More values...
},
Rule: aws.String("RuleName"), // Required
}
resp, err := svc.RemoveTargets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchEvents_TestEventPattern() {
svc := cloudwatchevents.New(session.New())
params := &cloudwatchevents.TestEventPatternInput{
Event: aws.String("String"), // Required
EventPattern: aws.String("EventPattern"), // Required
}
resp, err := svc.TestEventPattern(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,101 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatchevents
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Amazon CloudWatch Events helps you to respond to state changes in your AWS
// resources. When your resources change state they automatically send events
// into an event stream. You can create rules that match selected events in
// the stream and route them to targets to take action. You can also use rules
// to take action on a pre-determined schedule. For example, you can configure
// rules to:
//
// Automatically invoke an AWS Lambda function to update DNS entries when
// an event notifies you that Amazon EC2 instance enters the running state.
// Direct specific API records from CloudTrail to an Amazon Kinesis stream for
// detailed analysis of potential security or availability risks. Periodically
// invoke a built-in target to create a snapshot of an Amazon EBS volume.
// For more information about Amazon CloudWatch Events features, see the Amazon
// CloudWatch Developer Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudWatchEvents struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "events"
// New creates a new instance of the CloudWatchEvents client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudWatchEvents client from just a session.
// svc := cloudwatchevents.New(mySession)
//
// // Create a CloudWatchEvents client with additional configuration
// svc := cloudwatchevents.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatchEvents {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudWatchEvents {
svc := &CloudWatchEvents{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-10-07",
JSONVersion: "1.1",
TargetPrefix: "AWSEvents",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudWatchEvents operation and runs any
// custom request initialization.
func (c *CloudWatchEvents) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,128 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cloudwatchlogsiface provides an interface for the Amazon CloudWatch Logs.
package cloudwatchlogsiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
)
// CloudWatchLogsAPI is the interface type for cloudwatchlogs.CloudWatchLogs.
type CloudWatchLogsAPI interface {
CancelExportTaskRequest(*cloudwatchlogs.CancelExportTaskInput) (*request.Request, *cloudwatchlogs.CancelExportTaskOutput)
CancelExportTask(*cloudwatchlogs.CancelExportTaskInput) (*cloudwatchlogs.CancelExportTaskOutput, error)
CreateExportTaskRequest(*cloudwatchlogs.CreateExportTaskInput) (*request.Request, *cloudwatchlogs.CreateExportTaskOutput)
CreateExportTask(*cloudwatchlogs.CreateExportTaskInput) (*cloudwatchlogs.CreateExportTaskOutput, error)
CreateLogGroupRequest(*cloudwatchlogs.CreateLogGroupInput) (*request.Request, *cloudwatchlogs.CreateLogGroupOutput)
CreateLogGroup(*cloudwatchlogs.CreateLogGroupInput) (*cloudwatchlogs.CreateLogGroupOutput, error)
CreateLogStreamRequest(*cloudwatchlogs.CreateLogStreamInput) (*request.Request, *cloudwatchlogs.CreateLogStreamOutput)
CreateLogStream(*cloudwatchlogs.CreateLogStreamInput) (*cloudwatchlogs.CreateLogStreamOutput, error)
DeleteDestinationRequest(*cloudwatchlogs.DeleteDestinationInput) (*request.Request, *cloudwatchlogs.DeleteDestinationOutput)
DeleteDestination(*cloudwatchlogs.DeleteDestinationInput) (*cloudwatchlogs.DeleteDestinationOutput, error)
DeleteLogGroupRequest(*cloudwatchlogs.DeleteLogGroupInput) (*request.Request, *cloudwatchlogs.DeleteLogGroupOutput)
DeleteLogGroup(*cloudwatchlogs.DeleteLogGroupInput) (*cloudwatchlogs.DeleteLogGroupOutput, error)
DeleteLogStreamRequest(*cloudwatchlogs.DeleteLogStreamInput) (*request.Request, *cloudwatchlogs.DeleteLogStreamOutput)
DeleteLogStream(*cloudwatchlogs.DeleteLogStreamInput) (*cloudwatchlogs.DeleteLogStreamOutput, error)
DeleteMetricFilterRequest(*cloudwatchlogs.DeleteMetricFilterInput) (*request.Request, *cloudwatchlogs.DeleteMetricFilterOutput)
DeleteMetricFilter(*cloudwatchlogs.DeleteMetricFilterInput) (*cloudwatchlogs.DeleteMetricFilterOutput, error)
DeleteRetentionPolicyRequest(*cloudwatchlogs.DeleteRetentionPolicyInput) (*request.Request, *cloudwatchlogs.DeleteRetentionPolicyOutput)
DeleteRetentionPolicy(*cloudwatchlogs.DeleteRetentionPolicyInput) (*cloudwatchlogs.DeleteRetentionPolicyOutput, error)
DeleteSubscriptionFilterRequest(*cloudwatchlogs.DeleteSubscriptionFilterInput) (*request.Request, *cloudwatchlogs.DeleteSubscriptionFilterOutput)
DeleteSubscriptionFilter(*cloudwatchlogs.DeleteSubscriptionFilterInput) (*cloudwatchlogs.DeleteSubscriptionFilterOutput, error)
DescribeDestinationsRequest(*cloudwatchlogs.DescribeDestinationsInput) (*request.Request, *cloudwatchlogs.DescribeDestinationsOutput)
DescribeDestinations(*cloudwatchlogs.DescribeDestinationsInput) (*cloudwatchlogs.DescribeDestinationsOutput, error)
DescribeDestinationsPages(*cloudwatchlogs.DescribeDestinationsInput, func(*cloudwatchlogs.DescribeDestinationsOutput, bool) bool) error
DescribeExportTasksRequest(*cloudwatchlogs.DescribeExportTasksInput) (*request.Request, *cloudwatchlogs.DescribeExportTasksOutput)
DescribeExportTasks(*cloudwatchlogs.DescribeExportTasksInput) (*cloudwatchlogs.DescribeExportTasksOutput, error)
DescribeLogGroupsRequest(*cloudwatchlogs.DescribeLogGroupsInput) (*request.Request, *cloudwatchlogs.DescribeLogGroupsOutput)
DescribeLogGroups(*cloudwatchlogs.DescribeLogGroupsInput) (*cloudwatchlogs.DescribeLogGroupsOutput, error)
DescribeLogGroupsPages(*cloudwatchlogs.DescribeLogGroupsInput, func(*cloudwatchlogs.DescribeLogGroupsOutput, bool) bool) error
DescribeLogStreamsRequest(*cloudwatchlogs.DescribeLogStreamsInput) (*request.Request, *cloudwatchlogs.DescribeLogStreamsOutput)
DescribeLogStreams(*cloudwatchlogs.DescribeLogStreamsInput) (*cloudwatchlogs.DescribeLogStreamsOutput, error)
DescribeLogStreamsPages(*cloudwatchlogs.DescribeLogStreamsInput, func(*cloudwatchlogs.DescribeLogStreamsOutput, bool) bool) error
DescribeMetricFiltersRequest(*cloudwatchlogs.DescribeMetricFiltersInput) (*request.Request, *cloudwatchlogs.DescribeMetricFiltersOutput)
DescribeMetricFilters(*cloudwatchlogs.DescribeMetricFiltersInput) (*cloudwatchlogs.DescribeMetricFiltersOutput, error)
DescribeMetricFiltersPages(*cloudwatchlogs.DescribeMetricFiltersInput, func(*cloudwatchlogs.DescribeMetricFiltersOutput, bool) bool) error
DescribeSubscriptionFiltersRequest(*cloudwatchlogs.DescribeSubscriptionFiltersInput) (*request.Request, *cloudwatchlogs.DescribeSubscriptionFiltersOutput)
DescribeSubscriptionFilters(*cloudwatchlogs.DescribeSubscriptionFiltersInput) (*cloudwatchlogs.DescribeSubscriptionFiltersOutput, error)
DescribeSubscriptionFiltersPages(*cloudwatchlogs.DescribeSubscriptionFiltersInput, func(*cloudwatchlogs.DescribeSubscriptionFiltersOutput, bool) bool) error
FilterLogEventsRequest(*cloudwatchlogs.FilterLogEventsInput) (*request.Request, *cloudwatchlogs.FilterLogEventsOutput)
FilterLogEvents(*cloudwatchlogs.FilterLogEventsInput) (*cloudwatchlogs.FilterLogEventsOutput, error)
FilterLogEventsPages(*cloudwatchlogs.FilterLogEventsInput, func(*cloudwatchlogs.FilterLogEventsOutput, bool) bool) error
GetLogEventsRequest(*cloudwatchlogs.GetLogEventsInput) (*request.Request, *cloudwatchlogs.GetLogEventsOutput)
GetLogEvents(*cloudwatchlogs.GetLogEventsInput) (*cloudwatchlogs.GetLogEventsOutput, error)
GetLogEventsPages(*cloudwatchlogs.GetLogEventsInput, func(*cloudwatchlogs.GetLogEventsOutput, bool) bool) error
PutDestinationRequest(*cloudwatchlogs.PutDestinationInput) (*request.Request, *cloudwatchlogs.PutDestinationOutput)
PutDestination(*cloudwatchlogs.PutDestinationInput) (*cloudwatchlogs.PutDestinationOutput, error)
PutDestinationPolicyRequest(*cloudwatchlogs.PutDestinationPolicyInput) (*request.Request, *cloudwatchlogs.PutDestinationPolicyOutput)
PutDestinationPolicy(*cloudwatchlogs.PutDestinationPolicyInput) (*cloudwatchlogs.PutDestinationPolicyOutput, error)
PutLogEventsRequest(*cloudwatchlogs.PutLogEventsInput) (*request.Request, *cloudwatchlogs.PutLogEventsOutput)
PutLogEvents(*cloudwatchlogs.PutLogEventsInput) (*cloudwatchlogs.PutLogEventsOutput, error)
PutMetricFilterRequest(*cloudwatchlogs.PutMetricFilterInput) (*request.Request, *cloudwatchlogs.PutMetricFilterOutput)
PutMetricFilter(*cloudwatchlogs.PutMetricFilterInput) (*cloudwatchlogs.PutMetricFilterOutput, error)
PutRetentionPolicyRequest(*cloudwatchlogs.PutRetentionPolicyInput) (*request.Request, *cloudwatchlogs.PutRetentionPolicyOutput)
PutRetentionPolicy(*cloudwatchlogs.PutRetentionPolicyInput) (*cloudwatchlogs.PutRetentionPolicyOutput, error)
PutSubscriptionFilterRequest(*cloudwatchlogs.PutSubscriptionFilterInput) (*request.Request, *cloudwatchlogs.PutSubscriptionFilterOutput)
PutSubscriptionFilter(*cloudwatchlogs.PutSubscriptionFilterInput) (*cloudwatchlogs.PutSubscriptionFilterOutput, error)
TestMetricFilterRequest(*cloudwatchlogs.TestMetricFilterInput) (*request.Request, *cloudwatchlogs.TestMetricFilterOutput)
TestMetricFilter(*cloudwatchlogs.TestMetricFilterInput) (*cloudwatchlogs.TestMetricFilterOutput, error)
}
var _ CloudWatchLogsAPI = (*cloudwatchlogs.CloudWatchLogs)(nil)

View File

@@ -1,566 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatchlogs_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudWatchLogs_CancelExportTask() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.CancelExportTaskInput{
TaskId: aws.String("ExportTaskId"), // Required
}
resp, err := svc.CancelExportTask(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_CreateExportTask() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.CreateExportTaskInput{
Destination: aws.String("ExportDestinationBucket"), // Required
From: aws.Int64(1), // Required
LogGroupName: aws.String("LogGroupName"), // Required
To: aws.Int64(1), // Required
DestinationPrefix: aws.String("ExportDestinationPrefix"),
LogStreamNamePrefix: aws.String("LogStreamName"),
TaskName: aws.String("ExportTaskName"),
}
resp, err := svc.CreateExportTask(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_CreateLogGroup() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.CreateLogGroupInput{
LogGroupName: aws.String("LogGroupName"), // Required
}
resp, err := svc.CreateLogGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_CreateLogStream() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.CreateLogStreamInput{
LogGroupName: aws.String("LogGroupName"), // Required
LogStreamName: aws.String("LogStreamName"), // Required
}
resp, err := svc.CreateLogStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DeleteDestination() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DeleteDestinationInput{
DestinationName: aws.String("DestinationName"), // Required
}
resp, err := svc.DeleteDestination(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DeleteLogGroup() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DeleteLogGroupInput{
LogGroupName: aws.String("LogGroupName"), // Required
}
resp, err := svc.DeleteLogGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DeleteLogStream() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DeleteLogStreamInput{
LogGroupName: aws.String("LogGroupName"), // Required
LogStreamName: aws.String("LogStreamName"), // Required
}
resp, err := svc.DeleteLogStream(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DeleteMetricFilter() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DeleteMetricFilterInput{
FilterName: aws.String("FilterName"), // Required
LogGroupName: aws.String("LogGroupName"), // Required
}
resp, err := svc.DeleteMetricFilter(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DeleteRetentionPolicy() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DeleteRetentionPolicyInput{
LogGroupName: aws.String("LogGroupName"), // Required
}
resp, err := svc.DeleteRetentionPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DeleteSubscriptionFilter() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DeleteSubscriptionFilterInput{
FilterName: aws.String("FilterName"), // Required
LogGroupName: aws.String("LogGroupName"), // Required
}
resp, err := svc.DeleteSubscriptionFilter(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DescribeDestinations() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DescribeDestinationsInput{
DestinationNamePrefix: aws.String("DestinationName"),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeDestinations(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DescribeExportTasks() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DescribeExportTasksInput{
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
StatusCode: aws.String("ExportTaskStatusCode"),
TaskId: aws.String("ExportTaskId"),
}
resp, err := svc.DescribeExportTasks(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DescribeLogGroups() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DescribeLogGroupsInput{
Limit: aws.Int64(1),
LogGroupNamePrefix: aws.String("LogGroupName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeLogGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DescribeLogStreams() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DescribeLogStreamsInput{
LogGroupName: aws.String("LogGroupName"), // Required
Descending: aws.Bool(true),
Limit: aws.Int64(1),
LogStreamNamePrefix: aws.String("LogStreamName"),
NextToken: aws.String("NextToken"),
OrderBy: aws.String("OrderBy"),
}
resp, err := svc.DescribeLogStreams(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DescribeMetricFilters() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DescribeMetricFiltersInput{
LogGroupName: aws.String("LogGroupName"), // Required
FilterNamePrefix: aws.String("FilterName"),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeMetricFilters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_DescribeSubscriptionFilters() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.DescribeSubscriptionFiltersInput{
LogGroupName: aws.String("LogGroupName"), // Required
FilterNamePrefix: aws.String("FilterName"),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeSubscriptionFilters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_FilterLogEvents() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.FilterLogEventsInput{
LogGroupName: aws.String("LogGroupName"), // Required
EndTime: aws.Int64(1),
FilterPattern: aws.String("FilterPattern"),
Interleaved: aws.Bool(true),
Limit: aws.Int64(1),
LogStreamNames: []*string{
aws.String("LogStreamName"), // Required
// More values...
},
NextToken: aws.String("NextToken"),
StartTime: aws.Int64(1),
}
resp, err := svc.FilterLogEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_GetLogEvents() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.GetLogEventsInput{
LogGroupName: aws.String("LogGroupName"), // Required
LogStreamName: aws.String("LogStreamName"), // Required
EndTime: aws.Int64(1),
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
StartFromHead: aws.Bool(true),
StartTime: aws.Int64(1),
}
resp, err := svc.GetLogEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_PutDestination() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.PutDestinationInput{
DestinationName: aws.String("DestinationName"), // Required
RoleArn: aws.String("RoleArn"), // Required
TargetArn: aws.String("TargetArn"), // Required
}
resp, err := svc.PutDestination(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_PutDestinationPolicy() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.PutDestinationPolicyInput{
AccessPolicy: aws.String("AccessPolicy"), // Required
DestinationName: aws.String("DestinationName"), // Required
}
resp, err := svc.PutDestinationPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_PutLogEvents() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.PutLogEventsInput{
LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required
{ // Required
Message: aws.String("EventMessage"), // Required
Timestamp: aws.Int64(1), // Required
},
// More values...
},
LogGroupName: aws.String("LogGroupName"), // Required
LogStreamName: aws.String("LogStreamName"), // Required
SequenceToken: aws.String("SequenceToken"),
}
resp, err := svc.PutLogEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_PutMetricFilter() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.PutMetricFilterInput{
FilterName: aws.String("FilterName"), // Required
FilterPattern: aws.String("FilterPattern"), // Required
LogGroupName: aws.String("LogGroupName"), // Required
MetricTransformations: []*cloudwatchlogs.MetricTransformation{ // Required
{ // Required
MetricName: aws.String("MetricName"), // Required
MetricNamespace: aws.String("MetricNamespace"), // Required
MetricValue: aws.String("MetricValue"), // Required
},
// More values...
},
}
resp, err := svc.PutMetricFilter(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_PutRetentionPolicy() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.PutRetentionPolicyInput{
LogGroupName: aws.String("LogGroupName"), // Required
RetentionInDays: aws.Int64(1), // Required
}
resp, err := svc.PutRetentionPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_PutSubscriptionFilter() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.PutSubscriptionFilterInput{
DestinationArn: aws.String("DestinationArn"), // Required
FilterName: aws.String("FilterName"), // Required
FilterPattern: aws.String("FilterPattern"), // Required
LogGroupName: aws.String("LogGroupName"), // Required
RoleArn: aws.String("RoleArn"),
}
resp, err := svc.PutSubscriptionFilter(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCloudWatchLogs_TestMetricFilter() {
svc := cloudwatchlogs.New(session.New())
params := &cloudwatchlogs.TestMetricFilterInput{
FilterPattern: aws.String("FilterPattern"), // Required
LogEventMessages: []*string{ // Required
aws.String("EventMessage"), // Required
// More values...
},
}
resp, err := svc.TestMetricFilter(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,116 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cloudwatchlogs
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// You can use Amazon CloudWatch Logs to monitor, store, and access your log
// files from Amazon Elastic Compute Cloud (Amazon EC2) instances, Amazon CloudTrail,
// or other sources. You can then retrieve the associated log data from CloudWatch
// Logs using the Amazon CloudWatch console, the CloudWatch Logs commands in
// the AWS CLI, the CloudWatch Logs API, or the CloudWatch Logs SDK.
//
// You can use CloudWatch Logs to:
//
// Monitor Logs from Amazon EC2 Instances in Real-time: You can use CloudWatch
// Logs to monitor applications and systems using log data. For example, CloudWatch
// Logs can track the number of errors that occur in your application logs and
// send you a notification whenever the rate of errors exceeds a threshold you
// specify. CloudWatch Logs uses your log data for monitoring; so, no code changes
// are required. For example, you can monitor application logs for specific
// literal terms (such as "NullReferenceException") or count the number of occurrences
// of a literal term at a particular position in log data (such as "404" status
// codes in an Apache access log). When the term you are searching for is found,
// CloudWatch Logs reports the data to a Amazon CloudWatch metric that you specify.
//
// Monitor Amazon CloudTrail Logged Events: You can create alarms in Amazon
// CloudWatch and receive notifications of particular API activity as captured
// by CloudTrail and use the notification to perform troubleshooting.
//
// Archive Log Data: You can use CloudWatch Logs to store your log data in
// highly durable storage. You can change the log retention setting so that
// any log events older than this setting are automatically deleted. The CloudWatch
// Logs agent makes it easy to quickly send both rotated and non-rotated log
// data off of a host and into the log service. You can then access the raw
// log data when you need it.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CloudWatchLogs struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "logs"
// New creates a new instance of the CloudWatchLogs client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CloudWatchLogs client from just a session.
// svc := cloudwatchlogs.New(mySession)
//
// // Create a CloudWatchLogs client with additional configuration
// svc := cloudwatchlogs.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatchLogs {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudWatchLogs {
svc := &CloudWatchLogs{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2014-03-28",
JSONVersion: "1.1",
TargetPrefix: "Logs_20140328",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CloudWatchLogs operation and runs any
// custom request initialization.
func (c *CloudWatchLogs) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,78 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package codecommitiface provides an interface for the AWS CodeCommit.
package codecommitiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/codecommit"
)
// CodeCommitAPI is the interface type for codecommit.CodeCommit.
type CodeCommitAPI interface {
BatchGetRepositoriesRequest(*codecommit.BatchGetRepositoriesInput) (*request.Request, *codecommit.BatchGetRepositoriesOutput)
BatchGetRepositories(*codecommit.BatchGetRepositoriesInput) (*codecommit.BatchGetRepositoriesOutput, error)
CreateBranchRequest(*codecommit.CreateBranchInput) (*request.Request, *codecommit.CreateBranchOutput)
CreateBranch(*codecommit.CreateBranchInput) (*codecommit.CreateBranchOutput, error)
CreateRepositoryRequest(*codecommit.CreateRepositoryInput) (*request.Request, *codecommit.CreateRepositoryOutput)
CreateRepository(*codecommit.CreateRepositoryInput) (*codecommit.CreateRepositoryOutput, error)
DeleteRepositoryRequest(*codecommit.DeleteRepositoryInput) (*request.Request, *codecommit.DeleteRepositoryOutput)
DeleteRepository(*codecommit.DeleteRepositoryInput) (*codecommit.DeleteRepositoryOutput, error)
GetBranchRequest(*codecommit.GetBranchInput) (*request.Request, *codecommit.GetBranchOutput)
GetBranch(*codecommit.GetBranchInput) (*codecommit.GetBranchOutput, error)
GetCommitRequest(*codecommit.GetCommitInput) (*request.Request, *codecommit.GetCommitOutput)
GetCommit(*codecommit.GetCommitInput) (*codecommit.GetCommitOutput, error)
GetRepositoryRequest(*codecommit.GetRepositoryInput) (*request.Request, *codecommit.GetRepositoryOutput)
GetRepository(*codecommit.GetRepositoryInput) (*codecommit.GetRepositoryOutput, error)
GetRepositoryTriggersRequest(*codecommit.GetRepositoryTriggersInput) (*request.Request, *codecommit.GetRepositoryTriggersOutput)
GetRepositoryTriggers(*codecommit.GetRepositoryTriggersInput) (*codecommit.GetRepositoryTriggersOutput, error)
ListBranchesRequest(*codecommit.ListBranchesInput) (*request.Request, *codecommit.ListBranchesOutput)
ListBranches(*codecommit.ListBranchesInput) (*codecommit.ListBranchesOutput, error)
ListBranchesPages(*codecommit.ListBranchesInput, func(*codecommit.ListBranchesOutput, bool) bool) error
ListRepositoriesRequest(*codecommit.ListRepositoriesInput) (*request.Request, *codecommit.ListRepositoriesOutput)
ListRepositories(*codecommit.ListRepositoriesInput) (*codecommit.ListRepositoriesOutput, error)
ListRepositoriesPages(*codecommit.ListRepositoriesInput, func(*codecommit.ListRepositoriesOutput, bool) bool) error
PutRepositoryTriggersRequest(*codecommit.PutRepositoryTriggersInput) (*request.Request, *codecommit.PutRepositoryTriggersOutput)
PutRepositoryTriggers(*codecommit.PutRepositoryTriggersInput) (*codecommit.PutRepositoryTriggersOutput, error)
TestRepositoryTriggersRequest(*codecommit.TestRepositoryTriggersInput) (*request.Request, *codecommit.TestRepositoryTriggersOutput)
TestRepositoryTriggers(*codecommit.TestRepositoryTriggersInput) (*codecommit.TestRepositoryTriggersOutput, error)
UpdateDefaultBranchRequest(*codecommit.UpdateDefaultBranchInput) (*request.Request, *codecommit.UpdateDefaultBranchOutput)
UpdateDefaultBranch(*codecommit.UpdateDefaultBranchInput) (*codecommit.UpdateDefaultBranchOutput, error)
UpdateRepositoryDescriptionRequest(*codecommit.UpdateRepositoryDescriptionInput) (*request.Request, *codecommit.UpdateRepositoryDescriptionOutput)
UpdateRepositoryDescription(*codecommit.UpdateRepositoryDescriptionInput) (*codecommit.UpdateRepositoryDescriptionOutput, error)
UpdateRepositoryNameRequest(*codecommit.UpdateRepositoryNameInput) (*request.Request, *codecommit.UpdateRepositoryNameOutput)
UpdateRepositoryName(*codecommit.UpdateRepositoryNameInput) (*codecommit.UpdateRepositoryNameOutput, error)
}
var _ CodeCommitAPI = (*codecommit.CodeCommit)(nil)

View File

@@ -1,347 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package codecommit_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/codecommit"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCodeCommit_BatchGetRepositories() {
svc := codecommit.New(session.New())
params := &codecommit.BatchGetRepositoriesInput{
RepositoryNames: []*string{ // Required
aws.String("RepositoryName"), // Required
// More values...
},
}
resp, err := svc.BatchGetRepositories(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_CreateBranch() {
svc := codecommit.New(session.New())
params := &codecommit.CreateBranchInput{
BranchName: aws.String("BranchName"), // Required
CommitId: aws.String("CommitId"), // Required
RepositoryName: aws.String("RepositoryName"), // Required
}
resp, err := svc.CreateBranch(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_CreateRepository() {
svc := codecommit.New(session.New())
params := &codecommit.CreateRepositoryInput{
RepositoryName: aws.String("RepositoryName"), // Required
RepositoryDescription: aws.String("RepositoryDescription"),
}
resp, err := svc.CreateRepository(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_DeleteRepository() {
svc := codecommit.New(session.New())
params := &codecommit.DeleteRepositoryInput{
RepositoryName: aws.String("RepositoryName"), // Required
}
resp, err := svc.DeleteRepository(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_GetBranch() {
svc := codecommit.New(session.New())
params := &codecommit.GetBranchInput{
BranchName: aws.String("BranchName"),
RepositoryName: aws.String("RepositoryName"),
}
resp, err := svc.GetBranch(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_GetCommit() {
svc := codecommit.New(session.New())
params := &codecommit.GetCommitInput{
CommitId: aws.String("ObjectId"), // Required
RepositoryName: aws.String("RepositoryName"), // Required
}
resp, err := svc.GetCommit(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_GetRepository() {
svc := codecommit.New(session.New())
params := &codecommit.GetRepositoryInput{
RepositoryName: aws.String("RepositoryName"), // Required
}
resp, err := svc.GetRepository(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_GetRepositoryTriggers() {
svc := codecommit.New(session.New())
params := &codecommit.GetRepositoryTriggersInput{
RepositoryName: aws.String("RepositoryName"),
}
resp, err := svc.GetRepositoryTriggers(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_ListBranches() {
svc := codecommit.New(session.New())
params := &codecommit.ListBranchesInput{
RepositoryName: aws.String("RepositoryName"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListBranches(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_ListRepositories() {
svc := codecommit.New(session.New())
params := &codecommit.ListRepositoriesInput{
NextToken: aws.String("NextToken"),
Order: aws.String("OrderEnum"),
SortBy: aws.String("SortByEnum"),
}
resp, err := svc.ListRepositories(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_PutRepositoryTriggers() {
svc := codecommit.New(session.New())
params := &codecommit.PutRepositoryTriggersInput{
RepositoryName: aws.String("RepositoryName"),
Triggers: []*codecommit.RepositoryTrigger{
{ // Required
Branches: []*string{
aws.String("BranchName"), // Required
// More values...
},
CustomData: aws.String("RepositoryTriggerCustomData"),
DestinationArn: aws.String("Arn"),
Events: []*string{
aws.String("RepositoryTriggerEventEnum"), // Required
// More values...
},
Name: aws.String("RepositoryTriggerName"),
},
// More values...
},
}
resp, err := svc.PutRepositoryTriggers(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_TestRepositoryTriggers() {
svc := codecommit.New(session.New())
params := &codecommit.TestRepositoryTriggersInput{
RepositoryName: aws.String("RepositoryName"),
Triggers: []*codecommit.RepositoryTrigger{
{ // Required
Branches: []*string{
aws.String("BranchName"), // Required
// More values...
},
CustomData: aws.String("RepositoryTriggerCustomData"),
DestinationArn: aws.String("Arn"),
Events: []*string{
aws.String("RepositoryTriggerEventEnum"), // Required
// More values...
},
Name: aws.String("RepositoryTriggerName"),
},
// More values...
},
}
resp, err := svc.TestRepositoryTriggers(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_UpdateDefaultBranch() {
svc := codecommit.New(session.New())
params := &codecommit.UpdateDefaultBranchInput{
DefaultBranchName: aws.String("BranchName"), // Required
RepositoryName: aws.String("RepositoryName"), // Required
}
resp, err := svc.UpdateDefaultBranch(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_UpdateRepositoryDescription() {
svc := codecommit.New(session.New())
params := &codecommit.UpdateRepositoryDescriptionInput{
RepositoryName: aws.String("RepositoryName"), // Required
RepositoryDescription: aws.String("RepositoryDescription"),
}
resp, err := svc.UpdateRepositoryDescription(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeCommit_UpdateRepositoryName() {
svc := codecommit.New(session.New())
params := &codecommit.UpdateRepositoryNameInput{
NewName: aws.String("RepositoryName"), // Required
OldName: aws.String("RepositoryName"), // Required
}
resp, err := svc.UpdateRepositoryName(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,114 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package codecommit
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// This is the AWS CodeCommit API Reference. This reference provides descriptions
// of the operations and data types for AWS CodeCommit API.
//
// You can use the AWS CodeCommit API to work with the following objects:
//
// Repositories, by calling the following: BatchGetRepositories, which returns
// information about one or more repositories associated with your AWS account
// CreateRepository, which creates an AWS CodeCommit repository DeleteRepository,
// which deletes an AWS CodeCommit repository GetRepository, which returns information
// about a specified repository ListRepositories, which lists all AWS CodeCommit
// repositories associated with your AWS account UpdateRepositoryDescription,
// which sets or updates the description of the repository UpdateRepositoryName,
// which changes the name of the repository. If you change the name of a repository,
// no other users of that repository will be able to access it until you send
// them the new HTTPS or SSH URL to use. Branches, by calling the following:
// CreateBranch, which creates a new branch in a specified repository GetBranch,
// which returns information about a specified branch ListBranches, which lists
// all branches for a specified repository UpdateDefaultBranch, which changes
// the default branch for a repository Information about committed code in
// a repository, by calling the following: GetCommit, which returns information
// about a commit, including commit messages and committer information. Triggers,
// by calling the following: GetRepositoryTriggers, which returns information
// about triggers configured for a repository PutRepositoryTriggers, which replaces
// all triggers for a repository and can be used to create or delete triggers
// TestRepositoryTriggers, which tests the functionality of a repository trigger
// by sending data to the trigger target For information about how to use
// AWS CodeCommit, see the AWS CodeCommit User Guide (http://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CodeCommit struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "codecommit"
// New creates a new instance of the CodeCommit client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CodeCommit client from just a session.
// svc := codecommit.New(mySession)
//
// // Create a CodeCommit client with additional configuration
// svc := codecommit.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CodeCommit {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CodeCommit {
svc := &CodeCommit{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-04-13",
JSONVersion: "1.1",
TargetPrefix: "CodeCommit_20150413",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CodeCommit operation and runs any
// custom request initialization.
func (c *CodeCommit) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,166 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package codedeployiface provides an interface for the AWS CodeDeploy.
package codedeployiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/codedeploy"
)
// CodeDeployAPI is the interface type for codedeploy.CodeDeploy.
type CodeDeployAPI interface {
AddTagsToOnPremisesInstancesRequest(*codedeploy.AddTagsToOnPremisesInstancesInput) (*request.Request, *codedeploy.AddTagsToOnPremisesInstancesOutput)
AddTagsToOnPremisesInstances(*codedeploy.AddTagsToOnPremisesInstancesInput) (*codedeploy.AddTagsToOnPremisesInstancesOutput, error)
BatchGetApplicationRevisionsRequest(*codedeploy.BatchGetApplicationRevisionsInput) (*request.Request, *codedeploy.BatchGetApplicationRevisionsOutput)
BatchGetApplicationRevisions(*codedeploy.BatchGetApplicationRevisionsInput) (*codedeploy.BatchGetApplicationRevisionsOutput, error)
BatchGetApplicationsRequest(*codedeploy.BatchGetApplicationsInput) (*request.Request, *codedeploy.BatchGetApplicationsOutput)
BatchGetApplications(*codedeploy.BatchGetApplicationsInput) (*codedeploy.BatchGetApplicationsOutput, error)
BatchGetDeploymentGroupsRequest(*codedeploy.BatchGetDeploymentGroupsInput) (*request.Request, *codedeploy.BatchGetDeploymentGroupsOutput)
BatchGetDeploymentGroups(*codedeploy.BatchGetDeploymentGroupsInput) (*codedeploy.BatchGetDeploymentGroupsOutput, error)
BatchGetDeploymentInstancesRequest(*codedeploy.BatchGetDeploymentInstancesInput) (*request.Request, *codedeploy.BatchGetDeploymentInstancesOutput)
BatchGetDeploymentInstances(*codedeploy.BatchGetDeploymentInstancesInput) (*codedeploy.BatchGetDeploymentInstancesOutput, error)
BatchGetDeploymentsRequest(*codedeploy.BatchGetDeploymentsInput) (*request.Request, *codedeploy.BatchGetDeploymentsOutput)
BatchGetDeployments(*codedeploy.BatchGetDeploymentsInput) (*codedeploy.BatchGetDeploymentsOutput, error)
BatchGetOnPremisesInstancesRequest(*codedeploy.BatchGetOnPremisesInstancesInput) (*request.Request, *codedeploy.BatchGetOnPremisesInstancesOutput)
BatchGetOnPremisesInstances(*codedeploy.BatchGetOnPremisesInstancesInput) (*codedeploy.BatchGetOnPremisesInstancesOutput, error)
CreateApplicationRequest(*codedeploy.CreateApplicationInput) (*request.Request, *codedeploy.CreateApplicationOutput)
CreateApplication(*codedeploy.CreateApplicationInput) (*codedeploy.CreateApplicationOutput, error)
CreateDeploymentRequest(*codedeploy.CreateDeploymentInput) (*request.Request, *codedeploy.CreateDeploymentOutput)
CreateDeployment(*codedeploy.CreateDeploymentInput) (*codedeploy.CreateDeploymentOutput, error)
CreateDeploymentConfigRequest(*codedeploy.CreateDeploymentConfigInput) (*request.Request, *codedeploy.CreateDeploymentConfigOutput)
CreateDeploymentConfig(*codedeploy.CreateDeploymentConfigInput) (*codedeploy.CreateDeploymentConfigOutput, error)
CreateDeploymentGroupRequest(*codedeploy.CreateDeploymentGroupInput) (*request.Request, *codedeploy.CreateDeploymentGroupOutput)
CreateDeploymentGroup(*codedeploy.CreateDeploymentGroupInput) (*codedeploy.CreateDeploymentGroupOutput, error)
DeleteApplicationRequest(*codedeploy.DeleteApplicationInput) (*request.Request, *codedeploy.DeleteApplicationOutput)
DeleteApplication(*codedeploy.DeleteApplicationInput) (*codedeploy.DeleteApplicationOutput, error)
DeleteDeploymentConfigRequest(*codedeploy.DeleteDeploymentConfigInput) (*request.Request, *codedeploy.DeleteDeploymentConfigOutput)
DeleteDeploymentConfig(*codedeploy.DeleteDeploymentConfigInput) (*codedeploy.DeleteDeploymentConfigOutput, error)
DeleteDeploymentGroupRequest(*codedeploy.DeleteDeploymentGroupInput) (*request.Request, *codedeploy.DeleteDeploymentGroupOutput)
DeleteDeploymentGroup(*codedeploy.DeleteDeploymentGroupInput) (*codedeploy.DeleteDeploymentGroupOutput, error)
DeregisterOnPremisesInstanceRequest(*codedeploy.DeregisterOnPremisesInstanceInput) (*request.Request, *codedeploy.DeregisterOnPremisesInstanceOutput)
DeregisterOnPremisesInstance(*codedeploy.DeregisterOnPremisesInstanceInput) (*codedeploy.DeregisterOnPremisesInstanceOutput, error)
GetApplicationRequest(*codedeploy.GetApplicationInput) (*request.Request, *codedeploy.GetApplicationOutput)
GetApplication(*codedeploy.GetApplicationInput) (*codedeploy.GetApplicationOutput, error)
GetApplicationRevisionRequest(*codedeploy.GetApplicationRevisionInput) (*request.Request, *codedeploy.GetApplicationRevisionOutput)
GetApplicationRevision(*codedeploy.GetApplicationRevisionInput) (*codedeploy.GetApplicationRevisionOutput, error)
GetDeploymentRequest(*codedeploy.GetDeploymentInput) (*request.Request, *codedeploy.GetDeploymentOutput)
GetDeployment(*codedeploy.GetDeploymentInput) (*codedeploy.GetDeploymentOutput, error)
GetDeploymentConfigRequest(*codedeploy.GetDeploymentConfigInput) (*request.Request, *codedeploy.GetDeploymentConfigOutput)
GetDeploymentConfig(*codedeploy.GetDeploymentConfigInput) (*codedeploy.GetDeploymentConfigOutput, error)
GetDeploymentGroupRequest(*codedeploy.GetDeploymentGroupInput) (*request.Request, *codedeploy.GetDeploymentGroupOutput)
GetDeploymentGroup(*codedeploy.GetDeploymentGroupInput) (*codedeploy.GetDeploymentGroupOutput, error)
GetDeploymentInstanceRequest(*codedeploy.GetDeploymentInstanceInput) (*request.Request, *codedeploy.GetDeploymentInstanceOutput)
GetDeploymentInstance(*codedeploy.GetDeploymentInstanceInput) (*codedeploy.GetDeploymentInstanceOutput, error)
GetOnPremisesInstanceRequest(*codedeploy.GetOnPremisesInstanceInput) (*request.Request, *codedeploy.GetOnPremisesInstanceOutput)
GetOnPremisesInstance(*codedeploy.GetOnPremisesInstanceInput) (*codedeploy.GetOnPremisesInstanceOutput, error)
ListApplicationRevisionsRequest(*codedeploy.ListApplicationRevisionsInput) (*request.Request, *codedeploy.ListApplicationRevisionsOutput)
ListApplicationRevisions(*codedeploy.ListApplicationRevisionsInput) (*codedeploy.ListApplicationRevisionsOutput, error)
ListApplicationRevisionsPages(*codedeploy.ListApplicationRevisionsInput, func(*codedeploy.ListApplicationRevisionsOutput, bool) bool) error
ListApplicationsRequest(*codedeploy.ListApplicationsInput) (*request.Request, *codedeploy.ListApplicationsOutput)
ListApplications(*codedeploy.ListApplicationsInput) (*codedeploy.ListApplicationsOutput, error)
ListApplicationsPages(*codedeploy.ListApplicationsInput, func(*codedeploy.ListApplicationsOutput, bool) bool) error
ListDeploymentConfigsRequest(*codedeploy.ListDeploymentConfigsInput) (*request.Request, *codedeploy.ListDeploymentConfigsOutput)
ListDeploymentConfigs(*codedeploy.ListDeploymentConfigsInput) (*codedeploy.ListDeploymentConfigsOutput, error)
ListDeploymentConfigsPages(*codedeploy.ListDeploymentConfigsInput, func(*codedeploy.ListDeploymentConfigsOutput, bool) bool) error
ListDeploymentGroupsRequest(*codedeploy.ListDeploymentGroupsInput) (*request.Request, *codedeploy.ListDeploymentGroupsOutput)
ListDeploymentGroups(*codedeploy.ListDeploymentGroupsInput) (*codedeploy.ListDeploymentGroupsOutput, error)
ListDeploymentGroupsPages(*codedeploy.ListDeploymentGroupsInput, func(*codedeploy.ListDeploymentGroupsOutput, bool) bool) error
ListDeploymentInstancesRequest(*codedeploy.ListDeploymentInstancesInput) (*request.Request, *codedeploy.ListDeploymentInstancesOutput)
ListDeploymentInstances(*codedeploy.ListDeploymentInstancesInput) (*codedeploy.ListDeploymentInstancesOutput, error)
ListDeploymentInstancesPages(*codedeploy.ListDeploymentInstancesInput, func(*codedeploy.ListDeploymentInstancesOutput, bool) bool) error
ListDeploymentsRequest(*codedeploy.ListDeploymentsInput) (*request.Request, *codedeploy.ListDeploymentsOutput)
ListDeployments(*codedeploy.ListDeploymentsInput) (*codedeploy.ListDeploymentsOutput, error)
ListDeploymentsPages(*codedeploy.ListDeploymentsInput, func(*codedeploy.ListDeploymentsOutput, bool) bool) error
ListOnPremisesInstancesRequest(*codedeploy.ListOnPremisesInstancesInput) (*request.Request, *codedeploy.ListOnPremisesInstancesOutput)
ListOnPremisesInstances(*codedeploy.ListOnPremisesInstancesInput) (*codedeploy.ListOnPremisesInstancesOutput, error)
RegisterApplicationRevisionRequest(*codedeploy.RegisterApplicationRevisionInput) (*request.Request, *codedeploy.RegisterApplicationRevisionOutput)
RegisterApplicationRevision(*codedeploy.RegisterApplicationRevisionInput) (*codedeploy.RegisterApplicationRevisionOutput, error)
RegisterOnPremisesInstanceRequest(*codedeploy.RegisterOnPremisesInstanceInput) (*request.Request, *codedeploy.RegisterOnPremisesInstanceOutput)
RegisterOnPremisesInstance(*codedeploy.RegisterOnPremisesInstanceInput) (*codedeploy.RegisterOnPremisesInstanceOutput, error)
RemoveTagsFromOnPremisesInstancesRequest(*codedeploy.RemoveTagsFromOnPremisesInstancesInput) (*request.Request, *codedeploy.RemoveTagsFromOnPremisesInstancesOutput)
RemoveTagsFromOnPremisesInstances(*codedeploy.RemoveTagsFromOnPremisesInstancesInput) (*codedeploy.RemoveTagsFromOnPremisesInstancesOutput, error)
StopDeploymentRequest(*codedeploy.StopDeploymentInput) (*request.Request, *codedeploy.StopDeploymentOutput)
StopDeployment(*codedeploy.StopDeploymentInput) (*codedeploy.StopDeploymentOutput, error)
UpdateApplicationRequest(*codedeploy.UpdateApplicationInput) (*request.Request, *codedeploy.UpdateApplicationOutput)
UpdateApplication(*codedeploy.UpdateApplicationInput) (*codedeploy.UpdateApplicationOutput, error)
UpdateDeploymentGroupRequest(*codedeploy.UpdateDeploymentGroupInput) (*request.Request, *codedeploy.UpdateDeploymentGroupOutput)
UpdateDeploymentGroup(*codedeploy.UpdateDeploymentGroupInput) (*codedeploy.UpdateDeploymentGroupOutput, error)
}
var _ CodeDeployAPI = (*codedeploy.CodeDeploy)(nil)

View File

@@ -1,891 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package codedeploy_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/codedeploy"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCodeDeploy_AddTagsToOnPremisesInstances() {
svc := codedeploy.New(session.New())
params := &codedeploy.AddTagsToOnPremisesInstancesInput{
InstanceNames: []*string{ // Required
aws.String("InstanceName"), // Required
// More values...
},
Tags: []*codedeploy.Tag{ // Required
{ // Required
Key: aws.String("Key"),
Value: aws.String("Value"),
},
// More values...
},
}
resp, err := svc.AddTagsToOnPremisesInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_BatchGetApplicationRevisions() {
svc := codedeploy.New(session.New())
params := &codedeploy.BatchGetApplicationRevisionsInput{
ApplicationName: aws.String("ApplicationName"), // Required
Revisions: []*codedeploy.RevisionLocation{ // Required
{ // Required
GitHubLocation: &codedeploy.GitHubLocation{
CommitId: aws.String("CommitId"),
Repository: aws.String("Repository"),
},
RevisionType: aws.String("RevisionLocationType"),
S3Location: &codedeploy.S3Location{
Bucket: aws.String("S3Bucket"),
BundleType: aws.String("BundleType"),
ETag: aws.String("ETag"),
Key: aws.String("S3Key"),
Version: aws.String("VersionId"),
},
},
// More values...
},
}
resp, err := svc.BatchGetApplicationRevisions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_BatchGetApplications() {
svc := codedeploy.New(session.New())
params := &codedeploy.BatchGetApplicationsInput{
ApplicationNames: []*string{
aws.String("ApplicationName"), // Required
// More values...
},
}
resp, err := svc.BatchGetApplications(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_BatchGetDeploymentGroups() {
svc := codedeploy.New(session.New())
params := &codedeploy.BatchGetDeploymentGroupsInput{
ApplicationName: aws.String("ApplicationName"), // Required
DeploymentGroupNames: []*string{ // Required
aws.String("DeploymentGroupName"), // Required
// More values...
},
}
resp, err := svc.BatchGetDeploymentGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_BatchGetDeploymentInstances() {
svc := codedeploy.New(session.New())
params := &codedeploy.BatchGetDeploymentInstancesInput{
DeploymentId: aws.String("DeploymentId"), // Required
InstanceIds: []*string{ // Required
aws.String("InstanceId"), // Required
// More values...
},
}
resp, err := svc.BatchGetDeploymentInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_BatchGetDeployments() {
svc := codedeploy.New(session.New())
params := &codedeploy.BatchGetDeploymentsInput{
DeploymentIds: []*string{
aws.String("DeploymentId"), // Required
// More values...
},
}
resp, err := svc.BatchGetDeployments(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_BatchGetOnPremisesInstances() {
svc := codedeploy.New(session.New())
params := &codedeploy.BatchGetOnPremisesInstancesInput{
InstanceNames: []*string{
aws.String("InstanceName"), // Required
// More values...
},
}
resp, err := svc.BatchGetOnPremisesInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_CreateApplication() {
svc := codedeploy.New(session.New())
params := &codedeploy.CreateApplicationInput{
ApplicationName: aws.String("ApplicationName"), // Required
}
resp, err := svc.CreateApplication(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_CreateDeployment() {
svc := codedeploy.New(session.New())
params := &codedeploy.CreateDeploymentInput{
ApplicationName: aws.String("ApplicationName"), // Required
DeploymentConfigName: aws.String("DeploymentConfigName"),
DeploymentGroupName: aws.String("DeploymentGroupName"),
Description: aws.String("Description"),
IgnoreApplicationStopFailures: aws.Bool(true),
Revision: &codedeploy.RevisionLocation{
GitHubLocation: &codedeploy.GitHubLocation{
CommitId: aws.String("CommitId"),
Repository: aws.String("Repository"),
},
RevisionType: aws.String("RevisionLocationType"),
S3Location: &codedeploy.S3Location{
Bucket: aws.String("S3Bucket"),
BundleType: aws.String("BundleType"),
ETag: aws.String("ETag"),
Key: aws.String("S3Key"),
Version: aws.String("VersionId"),
},
},
}
resp, err := svc.CreateDeployment(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_CreateDeploymentConfig() {
svc := codedeploy.New(session.New())
params := &codedeploy.CreateDeploymentConfigInput{
DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
MinimumHealthyHosts: &codedeploy.MinimumHealthyHosts{
Type: aws.String("MinimumHealthyHostsType"),
Value: aws.Int64(1),
},
}
resp, err := svc.CreateDeploymentConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_CreateDeploymentGroup() {
svc := codedeploy.New(session.New())
params := &codedeploy.CreateDeploymentGroupInput{
ApplicationName: aws.String("ApplicationName"), // Required
DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
ServiceRoleArn: aws.String("Role"), // Required
AutoScalingGroups: []*string{
aws.String("AutoScalingGroupName"), // Required
// More values...
},
DeploymentConfigName: aws.String("DeploymentConfigName"),
Ec2TagFilters: []*codedeploy.EC2TagFilter{
{ // Required
Key: aws.String("Key"),
Type: aws.String("EC2TagFilterType"),
Value: aws.String("Value"),
},
// More values...
},
OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
{ // Required
Key: aws.String("Key"),
Type: aws.String("TagFilterType"),
Value: aws.String("Value"),
},
// More values...
},
TriggerConfigurations: []*codedeploy.TriggerConfig{
{ // Required
TriggerEvents: []*string{
aws.String("TriggerEventType"), // Required
// More values...
},
TriggerName: aws.String("TriggerName"),
TriggerTargetArn: aws.String("TriggerTargetArn"),
},
// More values...
},
}
resp, err := svc.CreateDeploymentGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_DeleteApplication() {
svc := codedeploy.New(session.New())
params := &codedeploy.DeleteApplicationInput{
ApplicationName: aws.String("ApplicationName"), // Required
}
resp, err := svc.DeleteApplication(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_DeleteDeploymentConfig() {
svc := codedeploy.New(session.New())
params := &codedeploy.DeleteDeploymentConfigInput{
DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
}
resp, err := svc.DeleteDeploymentConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_DeleteDeploymentGroup() {
svc := codedeploy.New(session.New())
params := &codedeploy.DeleteDeploymentGroupInput{
ApplicationName: aws.String("ApplicationName"), // Required
DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
}
resp, err := svc.DeleteDeploymentGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_DeregisterOnPremisesInstance() {
svc := codedeploy.New(session.New())
params := &codedeploy.DeregisterOnPremisesInstanceInput{
InstanceName: aws.String("InstanceName"), // Required
}
resp, err := svc.DeregisterOnPremisesInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetApplication() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetApplicationInput{
ApplicationName: aws.String("ApplicationName"), // Required
}
resp, err := svc.GetApplication(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetApplicationRevision() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetApplicationRevisionInput{
ApplicationName: aws.String("ApplicationName"), // Required
Revision: &codedeploy.RevisionLocation{ // Required
GitHubLocation: &codedeploy.GitHubLocation{
CommitId: aws.String("CommitId"),
Repository: aws.String("Repository"),
},
RevisionType: aws.String("RevisionLocationType"),
S3Location: &codedeploy.S3Location{
Bucket: aws.String("S3Bucket"),
BundleType: aws.String("BundleType"),
ETag: aws.String("ETag"),
Key: aws.String("S3Key"),
Version: aws.String("VersionId"),
},
},
}
resp, err := svc.GetApplicationRevision(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetDeployment() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetDeploymentInput{
DeploymentId: aws.String("DeploymentId"), // Required
}
resp, err := svc.GetDeployment(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetDeploymentConfig() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetDeploymentConfigInput{
DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
}
resp, err := svc.GetDeploymentConfig(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetDeploymentGroup() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetDeploymentGroupInput{
ApplicationName: aws.String("ApplicationName"), // Required
DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
}
resp, err := svc.GetDeploymentGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetDeploymentInstance() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetDeploymentInstanceInput{
DeploymentId: aws.String("DeploymentId"), // Required
InstanceId: aws.String("InstanceId"), // Required
}
resp, err := svc.GetDeploymentInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_GetOnPremisesInstance() {
svc := codedeploy.New(session.New())
params := &codedeploy.GetOnPremisesInstanceInput{
InstanceName: aws.String("InstanceName"), // Required
}
resp, err := svc.GetOnPremisesInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListApplicationRevisions() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListApplicationRevisionsInput{
ApplicationName: aws.String("ApplicationName"), // Required
Deployed: aws.String("ListStateFilterAction"),
NextToken: aws.String("NextToken"),
S3Bucket: aws.String("S3Bucket"),
S3KeyPrefix: aws.String("S3Key"),
SortBy: aws.String("ApplicationRevisionSortBy"),
SortOrder: aws.String("SortOrder"),
}
resp, err := svc.ListApplicationRevisions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListApplications() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListApplicationsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListApplications(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListDeploymentConfigs() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListDeploymentConfigsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListDeploymentConfigs(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListDeploymentGroups() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListDeploymentGroupsInput{
ApplicationName: aws.String("ApplicationName"), // Required
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListDeploymentGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListDeploymentInstances() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListDeploymentInstancesInput{
DeploymentId: aws.String("DeploymentId"), // Required
InstanceStatusFilter: []*string{
aws.String("InstanceStatus"), // Required
// More values...
},
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListDeploymentInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListDeployments() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListDeploymentsInput{
ApplicationName: aws.String("ApplicationName"),
CreateTimeRange: &codedeploy.TimeRange{
End: aws.Time(time.Now()),
Start: aws.Time(time.Now()),
},
DeploymentGroupName: aws.String("DeploymentGroupName"),
IncludeOnlyStatuses: []*string{
aws.String("DeploymentStatus"), // Required
// More values...
},
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListDeployments(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_ListOnPremisesInstances() {
svc := codedeploy.New(session.New())
params := &codedeploy.ListOnPremisesInstancesInput{
NextToken: aws.String("NextToken"),
RegistrationStatus: aws.String("RegistrationStatus"),
TagFilters: []*codedeploy.TagFilter{
{ // Required
Key: aws.String("Key"),
Type: aws.String("TagFilterType"),
Value: aws.String("Value"),
},
// More values...
},
}
resp, err := svc.ListOnPremisesInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_RegisterApplicationRevision() {
svc := codedeploy.New(session.New())
params := &codedeploy.RegisterApplicationRevisionInput{
ApplicationName: aws.String("ApplicationName"), // Required
Revision: &codedeploy.RevisionLocation{ // Required
GitHubLocation: &codedeploy.GitHubLocation{
CommitId: aws.String("CommitId"),
Repository: aws.String("Repository"),
},
RevisionType: aws.String("RevisionLocationType"),
S3Location: &codedeploy.S3Location{
Bucket: aws.String("S3Bucket"),
BundleType: aws.String("BundleType"),
ETag: aws.String("ETag"),
Key: aws.String("S3Key"),
Version: aws.String("VersionId"),
},
},
Description: aws.String("Description"),
}
resp, err := svc.RegisterApplicationRevision(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_RegisterOnPremisesInstance() {
svc := codedeploy.New(session.New())
params := &codedeploy.RegisterOnPremisesInstanceInput{
IamUserArn: aws.String("IamUserArn"), // Required
InstanceName: aws.String("InstanceName"), // Required
}
resp, err := svc.RegisterOnPremisesInstance(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() {
svc := codedeploy.New(session.New())
params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{
InstanceNames: []*string{ // Required
aws.String("InstanceName"), // Required
// More values...
},
Tags: []*codedeploy.Tag{ // Required
{ // Required
Key: aws.String("Key"),
Value: aws.String("Value"),
},
// More values...
},
}
resp, err := svc.RemoveTagsFromOnPremisesInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_StopDeployment() {
svc := codedeploy.New(session.New())
params := &codedeploy.StopDeploymentInput{
DeploymentId: aws.String("DeploymentId"), // Required
}
resp, err := svc.StopDeployment(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_UpdateApplication() {
svc := codedeploy.New(session.New())
params := &codedeploy.UpdateApplicationInput{
ApplicationName: aws.String("ApplicationName"),
NewApplicationName: aws.String("ApplicationName"),
}
resp, err := svc.UpdateApplication(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodeDeploy_UpdateDeploymentGroup() {
svc := codedeploy.New(session.New())
params := &codedeploy.UpdateDeploymentGroupInput{
ApplicationName: aws.String("ApplicationName"), // Required
CurrentDeploymentGroupName: aws.String("DeploymentGroupName"), // Required
AutoScalingGroups: []*string{
aws.String("AutoScalingGroupName"), // Required
// More values...
},
DeploymentConfigName: aws.String("DeploymentConfigName"),
Ec2TagFilters: []*codedeploy.EC2TagFilter{
{ // Required
Key: aws.String("Key"),
Type: aws.String("EC2TagFilterType"),
Value: aws.String("Value"),
},
// More values...
},
NewDeploymentGroupName: aws.String("DeploymentGroupName"),
OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
{ // Required
Key: aws.String("Key"),
Type: aws.String("TagFilterType"),
Value: aws.String("Value"),
},
// More values...
},
ServiceRoleArn: aws.String("Role"),
TriggerConfigurations: []*codedeploy.TriggerConfig{
{ // Required
TriggerEvents: []*string{
aws.String("TriggerEventType"), // Required
// More values...
},
TriggerName: aws.String("TriggerName"),
TriggerTargetArn: aws.String("TriggerTargetArn"),
},
// More values...
},
}
resp, err := svc.UpdateDeploymentGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,135 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package codedeploy
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Overview This reference guide provides descriptions of the AWS CodeDeploy
// APIs. For more information about AWS CodeDeploy, see the AWS CodeDeploy User
// Guide (docs.aws.amazon.com/codedeploy/latest/userguide).
//
// Using the APIs You can use the AWS CodeDeploy APIs to work with the following:
//
// Applications are unique identifiers used by AWS CodeDeploy to ensure the
// correct combinations of revisions, deployment configurations, and deployment
// groups are being referenced during deployments.
//
// You can use the AWS CodeDeploy APIs to create, delete, get, list, and update
// applications.
//
// Deployment configurations are sets of deployment rules and success and
// failure conditions used by AWS CodeDeploy during deployments.
//
// You can use the AWS CodeDeploy APIs to create, delete, get, and list deployment
// configurations.
//
// Deployment groups are groups of instances to which application revisions
// can be deployed.
//
// You can use the AWS CodeDeploy APIs to create, delete, get, list, and update
// deployment groups.
//
// Instances represent Amazon EC2 instances to which application revisions
// are deployed. Instances are identified by their Amazon EC2 tags or Auto Scaling
// group names. Instances belong to deployment groups.
//
// You can use the AWS CodeDeploy APIs to get and list instance.
//
// Deployments represent the process of deploying revisions to instances.
//
// You can use the AWS CodeDeploy APIs to create, get, list, and stop deployments.
//
// Application revisions are archive files stored in Amazon S3 buckets or
// GitHub repositories. These revisions contain source content (such as source
// code, web pages, executable files, and deployment scripts) along with an
// application specification (AppSpec) file. (The AppSpec file is unique to
// AWS CodeDeploy; it defines the deployment actions you want AWS CodeDeploy
// to execute.) Ffor application revisions stored in Amazon S3 buckets, an application
// revision is uniquely identified by its Amazon S3 object key and its ETag,
// version, or both. For application revisions stored in GitHub repositories,
// an application revision is uniquely identified by its repository name and
// commit ID. Application revisions are deployed through deployment groups.
//
// You can use the AWS CodeDeploy APIs to get, list, and register application
// revisions.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CodeDeploy struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "codedeploy"
// New creates a new instance of the CodeDeploy client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CodeDeploy client from just a session.
// svc := codedeploy.New(mySession)
//
// // Create a CodeDeploy client with additional configuration
// svc := codedeploy.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CodeDeploy {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CodeDeploy {
svc := &CodeDeploy{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2014-10-06",
JSONVersion: "1.1",
TargetPrefix: "CodeDeploy_20141006",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CodeDeploy operation and runs any
// custom request initialization.
func (c *CodeDeploy) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,114 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package codepipelineiface provides an interface for the AWS CodePipeline.
package codepipelineiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/codepipeline"
)
// CodePipelineAPI is the interface type for codepipeline.CodePipeline.
type CodePipelineAPI interface {
AcknowledgeJobRequest(*codepipeline.AcknowledgeJobInput) (*request.Request, *codepipeline.AcknowledgeJobOutput)
AcknowledgeJob(*codepipeline.AcknowledgeJobInput) (*codepipeline.AcknowledgeJobOutput, error)
AcknowledgeThirdPartyJobRequest(*codepipeline.AcknowledgeThirdPartyJobInput) (*request.Request, *codepipeline.AcknowledgeThirdPartyJobOutput)
AcknowledgeThirdPartyJob(*codepipeline.AcknowledgeThirdPartyJobInput) (*codepipeline.AcknowledgeThirdPartyJobOutput, error)
CreateCustomActionTypeRequest(*codepipeline.CreateCustomActionTypeInput) (*request.Request, *codepipeline.CreateCustomActionTypeOutput)
CreateCustomActionType(*codepipeline.CreateCustomActionTypeInput) (*codepipeline.CreateCustomActionTypeOutput, error)
CreatePipelineRequest(*codepipeline.CreatePipelineInput) (*request.Request, *codepipeline.CreatePipelineOutput)
CreatePipeline(*codepipeline.CreatePipelineInput) (*codepipeline.CreatePipelineOutput, error)
DeleteCustomActionTypeRequest(*codepipeline.DeleteCustomActionTypeInput) (*request.Request, *codepipeline.DeleteCustomActionTypeOutput)
DeleteCustomActionType(*codepipeline.DeleteCustomActionTypeInput) (*codepipeline.DeleteCustomActionTypeOutput, error)
DeletePipelineRequest(*codepipeline.DeletePipelineInput) (*request.Request, *codepipeline.DeletePipelineOutput)
DeletePipeline(*codepipeline.DeletePipelineInput) (*codepipeline.DeletePipelineOutput, error)
DisableStageTransitionRequest(*codepipeline.DisableStageTransitionInput) (*request.Request, *codepipeline.DisableStageTransitionOutput)
DisableStageTransition(*codepipeline.DisableStageTransitionInput) (*codepipeline.DisableStageTransitionOutput, error)
EnableStageTransitionRequest(*codepipeline.EnableStageTransitionInput) (*request.Request, *codepipeline.EnableStageTransitionOutput)
EnableStageTransition(*codepipeline.EnableStageTransitionInput) (*codepipeline.EnableStageTransitionOutput, error)
GetJobDetailsRequest(*codepipeline.GetJobDetailsInput) (*request.Request, *codepipeline.GetJobDetailsOutput)
GetJobDetails(*codepipeline.GetJobDetailsInput) (*codepipeline.GetJobDetailsOutput, error)
GetPipelineRequest(*codepipeline.GetPipelineInput) (*request.Request, *codepipeline.GetPipelineOutput)
GetPipeline(*codepipeline.GetPipelineInput) (*codepipeline.GetPipelineOutput, error)
GetPipelineStateRequest(*codepipeline.GetPipelineStateInput) (*request.Request, *codepipeline.GetPipelineStateOutput)
GetPipelineState(*codepipeline.GetPipelineStateInput) (*codepipeline.GetPipelineStateOutput, error)
GetThirdPartyJobDetailsRequest(*codepipeline.GetThirdPartyJobDetailsInput) (*request.Request, *codepipeline.GetThirdPartyJobDetailsOutput)
GetThirdPartyJobDetails(*codepipeline.GetThirdPartyJobDetailsInput) (*codepipeline.GetThirdPartyJobDetailsOutput, error)
ListActionTypesRequest(*codepipeline.ListActionTypesInput) (*request.Request, *codepipeline.ListActionTypesOutput)
ListActionTypes(*codepipeline.ListActionTypesInput) (*codepipeline.ListActionTypesOutput, error)
ListPipelinesRequest(*codepipeline.ListPipelinesInput) (*request.Request, *codepipeline.ListPipelinesOutput)
ListPipelines(*codepipeline.ListPipelinesInput) (*codepipeline.ListPipelinesOutput, error)
PollForJobsRequest(*codepipeline.PollForJobsInput) (*request.Request, *codepipeline.PollForJobsOutput)
PollForJobs(*codepipeline.PollForJobsInput) (*codepipeline.PollForJobsOutput, error)
PollForThirdPartyJobsRequest(*codepipeline.PollForThirdPartyJobsInput) (*request.Request, *codepipeline.PollForThirdPartyJobsOutput)
PollForThirdPartyJobs(*codepipeline.PollForThirdPartyJobsInput) (*codepipeline.PollForThirdPartyJobsOutput, error)
PutActionRevisionRequest(*codepipeline.PutActionRevisionInput) (*request.Request, *codepipeline.PutActionRevisionOutput)
PutActionRevision(*codepipeline.PutActionRevisionInput) (*codepipeline.PutActionRevisionOutput, error)
PutApprovalResultRequest(*codepipeline.PutApprovalResultInput) (*request.Request, *codepipeline.PutApprovalResultOutput)
PutApprovalResult(*codepipeline.PutApprovalResultInput) (*codepipeline.PutApprovalResultOutput, error)
PutJobFailureResultRequest(*codepipeline.PutJobFailureResultInput) (*request.Request, *codepipeline.PutJobFailureResultOutput)
PutJobFailureResult(*codepipeline.PutJobFailureResultInput) (*codepipeline.PutJobFailureResultOutput, error)
PutJobSuccessResultRequest(*codepipeline.PutJobSuccessResultInput) (*request.Request, *codepipeline.PutJobSuccessResultOutput)
PutJobSuccessResult(*codepipeline.PutJobSuccessResultInput) (*codepipeline.PutJobSuccessResultOutput, error)
PutThirdPartyJobFailureResultRequest(*codepipeline.PutThirdPartyJobFailureResultInput) (*request.Request, *codepipeline.PutThirdPartyJobFailureResultOutput)
PutThirdPartyJobFailureResult(*codepipeline.PutThirdPartyJobFailureResultInput) (*codepipeline.PutThirdPartyJobFailureResultOutput, error)
PutThirdPartyJobSuccessResultRequest(*codepipeline.PutThirdPartyJobSuccessResultInput) (*request.Request, *codepipeline.PutThirdPartyJobSuccessResultOutput)
PutThirdPartyJobSuccessResult(*codepipeline.PutThirdPartyJobSuccessResultInput) (*codepipeline.PutThirdPartyJobSuccessResultOutput, error)
RetryStageExecutionRequest(*codepipeline.RetryStageExecutionInput) (*request.Request, *codepipeline.RetryStageExecutionOutput)
RetryStageExecution(*codepipeline.RetryStageExecutionInput) (*codepipeline.RetryStageExecutionOutput, error)
StartPipelineExecutionRequest(*codepipeline.StartPipelineExecutionInput) (*request.Request, *codepipeline.StartPipelineExecutionOutput)
StartPipelineExecution(*codepipeline.StartPipelineExecutionInput) (*codepipeline.StartPipelineExecutionOutput, error)
UpdatePipelineRequest(*codepipeline.UpdatePipelineInput) (*request.Request, *codepipeline.UpdatePipelineOutput)
UpdatePipeline(*codepipeline.UpdatePipelineInput) (*codepipeline.UpdatePipelineOutput, error)
}
var _ CodePipelineAPI = (*codepipeline.CodePipeline)(nil)

View File

@@ -1,707 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package codepipeline_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/codepipeline"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCodePipeline_AcknowledgeJob() {
svc := codepipeline.New(session.New())
params := &codepipeline.AcknowledgeJobInput{
JobId: aws.String("JobId"), // Required
Nonce: aws.String("Nonce"), // Required
}
resp, err := svc.AcknowledgeJob(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_AcknowledgeThirdPartyJob() {
svc := codepipeline.New(session.New())
params := &codepipeline.AcknowledgeThirdPartyJobInput{
ClientToken: aws.String("ClientToken"), // Required
JobId: aws.String("ThirdPartyJobId"), // Required
Nonce: aws.String("Nonce"), // Required
}
resp, err := svc.AcknowledgeThirdPartyJob(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_CreateCustomActionType() {
svc := codepipeline.New(session.New())
params := &codepipeline.CreateCustomActionTypeInput{
Category: aws.String("ActionCategory"), // Required
InputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
MaximumCount: aws.Int64(1), // Required
MinimumCount: aws.Int64(1), // Required
},
OutputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
MaximumCount: aws.Int64(1), // Required
MinimumCount: aws.Int64(1), // Required
},
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
ConfigurationProperties: []*codepipeline.ActionConfigurationProperty{
{ // Required
Key: aws.Bool(true), // Required
Name: aws.String("ActionConfigurationKey"), // Required
Required: aws.Bool(true), // Required
Secret: aws.Bool(true), // Required
Description: aws.String("Description"),
Queryable: aws.Bool(true),
Type: aws.String("ActionConfigurationPropertyType"),
},
// More values...
},
Settings: &codepipeline.ActionTypeSettings{
EntityUrlTemplate: aws.String("UrlTemplate"),
ExecutionUrlTemplate: aws.String("UrlTemplate"),
RevisionUrlTemplate: aws.String("UrlTemplate"),
ThirdPartyConfigurationUrl: aws.String("Url"),
},
}
resp, err := svc.CreateCustomActionType(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_CreatePipeline() {
svc := codepipeline.New(session.New())
params := &codepipeline.CreatePipelineInput{
Pipeline: &codepipeline.PipelineDeclaration{ // Required
ArtifactStore: &codepipeline.ArtifactStore{ // Required
Location: aws.String("ArtifactStoreLocation"), // Required
Type: aws.String("ArtifactStoreType"), // Required
EncryptionKey: &codepipeline.EncryptionKey{
Id: aws.String("EncryptionKeyId"), // Required
Type: aws.String("EncryptionKeyType"), // Required
},
},
Name: aws.String("PipelineName"), // Required
RoleArn: aws.String("RoleArn"), // Required
Stages: []*codepipeline.StageDeclaration{ // Required
{ // Required
Actions: []*codepipeline.ActionDeclaration{ // Required
{ // Required
ActionTypeId: &codepipeline.ActionTypeId{ // Required
Category: aws.String("ActionCategory"), // Required
Owner: aws.String("ActionOwner"), // Required
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
},
Name: aws.String("ActionName"), // Required
Configuration: map[string]*string{
"Key": aws.String("ActionConfigurationValue"), // Required
// More values...
},
InputArtifacts: []*codepipeline.InputArtifact{
{ // Required
Name: aws.String("ArtifactName"), // Required
},
// More values...
},
OutputArtifacts: []*codepipeline.OutputArtifact{
{ // Required
Name: aws.String("ArtifactName"), // Required
},
// More values...
},
RoleArn: aws.String("RoleArn"),
RunOrder: aws.Int64(1),
},
// More values...
},
Name: aws.String("StageName"), // Required
Blockers: []*codepipeline.BlockerDeclaration{
{ // Required
Name: aws.String("BlockerName"), // Required
Type: aws.String("BlockerType"), // Required
},
// More values...
},
},
// More values...
},
Version: aws.Int64(1),
},
}
resp, err := svc.CreatePipeline(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_DeleteCustomActionType() {
svc := codepipeline.New(session.New())
params := &codepipeline.DeleteCustomActionTypeInput{
Category: aws.String("ActionCategory"), // Required
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
}
resp, err := svc.DeleteCustomActionType(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_DeletePipeline() {
svc := codepipeline.New(session.New())
params := &codepipeline.DeletePipelineInput{
Name: aws.String("PipelineName"), // Required
}
resp, err := svc.DeletePipeline(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_DisableStageTransition() {
svc := codepipeline.New(session.New())
params := &codepipeline.DisableStageTransitionInput{
PipelineName: aws.String("PipelineName"), // Required
Reason: aws.String("DisabledReason"), // Required
StageName: aws.String("StageName"), // Required
TransitionType: aws.String("StageTransitionType"), // Required
}
resp, err := svc.DisableStageTransition(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_EnableStageTransition() {
svc := codepipeline.New(session.New())
params := &codepipeline.EnableStageTransitionInput{
PipelineName: aws.String("PipelineName"), // Required
StageName: aws.String("StageName"), // Required
TransitionType: aws.String("StageTransitionType"), // Required
}
resp, err := svc.EnableStageTransition(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_GetJobDetails() {
svc := codepipeline.New(session.New())
params := &codepipeline.GetJobDetailsInput{
JobId: aws.String("JobId"), // Required
}
resp, err := svc.GetJobDetails(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_GetPipeline() {
svc := codepipeline.New(session.New())
params := &codepipeline.GetPipelineInput{
Name: aws.String("PipelineName"), // Required
Version: aws.Int64(1),
}
resp, err := svc.GetPipeline(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_GetPipelineState() {
svc := codepipeline.New(session.New())
params := &codepipeline.GetPipelineStateInput{
Name: aws.String("PipelineName"), // Required
}
resp, err := svc.GetPipelineState(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_GetThirdPartyJobDetails() {
svc := codepipeline.New(session.New())
params := &codepipeline.GetThirdPartyJobDetailsInput{
ClientToken: aws.String("ClientToken"), // Required
JobId: aws.String("ThirdPartyJobId"), // Required
}
resp, err := svc.GetThirdPartyJobDetails(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_ListActionTypes() {
svc := codepipeline.New(session.New())
params := &codepipeline.ListActionTypesInput{
ActionOwnerFilter: aws.String("ActionOwner"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListActionTypes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_ListPipelines() {
svc := codepipeline.New(session.New())
params := &codepipeline.ListPipelinesInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListPipelines(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PollForJobs() {
svc := codepipeline.New(session.New())
params := &codepipeline.PollForJobsInput{
ActionTypeId: &codepipeline.ActionTypeId{ // Required
Category: aws.String("ActionCategory"), // Required
Owner: aws.String("ActionOwner"), // Required
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
},
MaxBatchSize: aws.Int64(1),
QueryParam: map[string]*string{
"Key": aws.String("ActionConfigurationQueryableValue"), // Required
// More values...
},
}
resp, err := svc.PollForJobs(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PollForThirdPartyJobs() {
svc := codepipeline.New(session.New())
params := &codepipeline.PollForThirdPartyJobsInput{
ActionTypeId: &codepipeline.ActionTypeId{ // Required
Category: aws.String("ActionCategory"), // Required
Owner: aws.String("ActionOwner"), // Required
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
},
MaxBatchSize: aws.Int64(1),
}
resp, err := svc.PollForThirdPartyJobs(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PutActionRevision() {
svc := codepipeline.New(session.New())
params := &codepipeline.PutActionRevisionInput{
ActionName: aws.String("ActionName"), // Required
ActionRevision: &codepipeline.ActionRevision{ // Required
Created: aws.Time(time.Now()), // Required
RevisionChangeId: aws.String("RevisionChangeIdentifier"), // Required
RevisionId: aws.String("Revision"), // Required
},
PipelineName: aws.String("PipelineName"), // Required
StageName: aws.String("StageName"), // Required
}
resp, err := svc.PutActionRevision(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PutApprovalResult() {
svc := codepipeline.New(session.New())
params := &codepipeline.PutApprovalResultInput{
ActionName: aws.String("ActionName"), // Required
PipelineName: aws.String("PipelineName"), // Required
Result: &codepipeline.ApprovalResult{ // Required
Status: aws.String("ApprovalStatus"), // Required
Summary: aws.String("ApprovalSummary"), // Required
},
StageName: aws.String("StageName"), // Required
Token: aws.String("ApprovalToken"),
}
resp, err := svc.PutApprovalResult(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PutJobFailureResult() {
svc := codepipeline.New(session.New())
params := &codepipeline.PutJobFailureResultInput{
FailureDetails: &codepipeline.FailureDetails{ // Required
Message: aws.String("Message"), // Required
Type: aws.String("FailureType"), // Required
ExternalExecutionId: aws.String("ExecutionId"),
},
JobId: aws.String("JobId"), // Required
}
resp, err := svc.PutJobFailureResult(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PutJobSuccessResult() {
svc := codepipeline.New(session.New())
params := &codepipeline.PutJobSuccessResultInput{
JobId: aws.String("JobId"), // Required
ContinuationToken: aws.String("ContinuationToken"),
CurrentRevision: &codepipeline.CurrentRevision{
ChangeIdentifier: aws.String("RevisionChangeIdentifier"), // Required
Revision: aws.String("Revision"), // Required
},
ExecutionDetails: &codepipeline.ExecutionDetails{
ExternalExecutionId: aws.String("ExecutionId"),
PercentComplete: aws.Int64(1),
Summary: aws.String("ExecutionSummary"),
},
}
resp, err := svc.PutJobSuccessResult(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PutThirdPartyJobFailureResult() {
svc := codepipeline.New(session.New())
params := &codepipeline.PutThirdPartyJobFailureResultInput{
ClientToken: aws.String("ClientToken"), // Required
FailureDetails: &codepipeline.FailureDetails{ // Required
Message: aws.String("Message"), // Required
Type: aws.String("FailureType"), // Required
ExternalExecutionId: aws.String("ExecutionId"),
},
JobId: aws.String("ThirdPartyJobId"), // Required
}
resp, err := svc.PutThirdPartyJobFailureResult(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_PutThirdPartyJobSuccessResult() {
svc := codepipeline.New(session.New())
params := &codepipeline.PutThirdPartyJobSuccessResultInput{
ClientToken: aws.String("ClientToken"), // Required
JobId: aws.String("ThirdPartyJobId"), // Required
ContinuationToken: aws.String("ContinuationToken"),
CurrentRevision: &codepipeline.CurrentRevision{
ChangeIdentifier: aws.String("RevisionChangeIdentifier"), // Required
Revision: aws.String("Revision"), // Required
},
ExecutionDetails: &codepipeline.ExecutionDetails{
ExternalExecutionId: aws.String("ExecutionId"),
PercentComplete: aws.Int64(1),
Summary: aws.String("ExecutionSummary"),
},
}
resp, err := svc.PutThirdPartyJobSuccessResult(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_RetryStageExecution() {
svc := codepipeline.New(session.New())
params := &codepipeline.RetryStageExecutionInput{
PipelineExecutionId: aws.String("PipelineExecutionId"), // Required
PipelineName: aws.String("PipelineName"), // Required
RetryMode: aws.String("StageRetryMode"), // Required
StageName: aws.String("StageName"), // Required
}
resp, err := svc.RetryStageExecution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_StartPipelineExecution() {
svc := codepipeline.New(session.New())
params := &codepipeline.StartPipelineExecutionInput{
Name: aws.String("PipelineName"), // Required
}
resp, err := svc.StartPipelineExecution(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCodePipeline_UpdatePipeline() {
svc := codepipeline.New(session.New())
params := &codepipeline.UpdatePipelineInput{
Pipeline: &codepipeline.PipelineDeclaration{ // Required
ArtifactStore: &codepipeline.ArtifactStore{ // Required
Location: aws.String("ArtifactStoreLocation"), // Required
Type: aws.String("ArtifactStoreType"), // Required
EncryptionKey: &codepipeline.EncryptionKey{
Id: aws.String("EncryptionKeyId"), // Required
Type: aws.String("EncryptionKeyType"), // Required
},
},
Name: aws.String("PipelineName"), // Required
RoleArn: aws.String("RoleArn"), // Required
Stages: []*codepipeline.StageDeclaration{ // Required
{ // Required
Actions: []*codepipeline.ActionDeclaration{ // Required
{ // Required
ActionTypeId: &codepipeline.ActionTypeId{ // Required
Category: aws.String("ActionCategory"), // Required
Owner: aws.String("ActionOwner"), // Required
Provider: aws.String("ActionProvider"), // Required
Version: aws.String("Version"), // Required
},
Name: aws.String("ActionName"), // Required
Configuration: map[string]*string{
"Key": aws.String("ActionConfigurationValue"), // Required
// More values...
},
InputArtifacts: []*codepipeline.InputArtifact{
{ // Required
Name: aws.String("ArtifactName"), // Required
},
// More values...
},
OutputArtifacts: []*codepipeline.OutputArtifact{
{ // Required
Name: aws.String("ArtifactName"), // Required
},
// More values...
},
RoleArn: aws.String("RoleArn"),
RunOrder: aws.Int64(1),
},
// More values...
},
Name: aws.String("StageName"), // Required
Blockers: []*codepipeline.BlockerDeclaration{
{ // Required
Name: aws.String("BlockerName"), // Required
Type: aws.String("BlockerType"), // Required
},
// More values...
},
},
// More values...
},
Version: aws.Int64(1),
},
}
resp, err := svc.UpdatePipeline(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,192 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package codepipeline
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Overview
//
// This is the AWS CodePipeline API Reference. This guide provides descriptions
// of the actions and data types for AWS CodePipeline. Some functionality for
// your pipeline is only configurable through the API. For additional information,
// see the AWS CodePipeline User Guide (http://docs.aws.amazon.com/codepipeline/latest/userguide/welcome.html).
//
// You can use the AWS CodePipeline API to work with pipelines, stages, actions,
// gates, and transitions, as described below.
//
// Pipelines are models of automated release processes. Each pipeline is uniquely
// named, and consists of actions, gates, and stages.
//
// You can work with pipelines by calling:
//
// CreatePipeline, which creates a uniquely-named pipeline.
//
// DeletePipeline, which deletes the specified pipeline.
//
// GetPipeline, which returns information about a pipeline structure.
//
// GetPipelineState, which returns information about the current state of
// the stages and actions of a pipeline.
//
// ListPipelines, which gets a summary of all of the pipelines associated
// with your account.
//
// StartPipelineExecution, which runs the the most recent revision of an
// artifact through the pipeline.
//
// UpdatePipeline, which updates a pipeline with edits or changes to the
// structure of the pipeline.
//
// Pipelines include stages, which are which are logical groupings of gates
// and actions. Each stage contains one or more actions that must complete before
// the next stage begins. A stage will result in success or failure. If a stage
// fails, then the pipeline stops at that stage and will remain stopped until
// either a new version of an artifact appears in the source location, or a
// user takes action to re-run the most recent artifact through the pipeline.
// You can call GetPipelineState, which displays the status of a pipeline, including
// the status of stages in the pipeline, or GetPipeline, which returns the entire
// structure of the pipeline, including the stages of that pipeline. For more
// information about the structure of stages and actions, also refer to the
// AWS CodePipeline Pipeline Structure Reference (http://docs.aws.amazon.com/codepipeline/latest/userguide/pipeline-structure.html).
//
// Pipeline stages include actions, which are categorized into categories such
// as source or build actions performed within a stage of a pipeline. For example,
// you can use a source action to import artifacts into a pipeline from a source
// such as Amazon S3. Like stages, you do not work with actions directly in
// most cases, but you do define and interact with actions when working with
// pipeline operations such as CreatePipeline and GetPipelineState.
//
// Pipelines also include transitions, which allow the transition of artifacts
// from one stage to the next in a pipeline after the actions in one stage complete.
//
// You can work with transitions by calling:
//
// DisableStageTransition, which prevents artifacts from transitioning to
// the next stage in a pipeline.
//
// EnableStageTransition, which enables transition of artifacts between
// stages in a pipeline.
//
// Using the API to integrate with AWS CodePipeline
//
// For third-party integrators or developers who want to create their own integrations
// with AWS CodePipeline, the expected sequence varies from the standard API
// user. In order to integrate with AWS CodePipeline, developers will need to
// work with the following items:
//
// Jobs, which are instances of an action. For example, a job for a source
// action might import a revision of an artifact from a source.
//
// You can work with jobs by calling:
//
// AcknowledgeJob, which confirms whether a job worker has received the
// specified job,
//
// GetJobDetails, which returns the details of a job,
//
// PollForJobs, which determines whether there are any jobs to act upon,
//
// PutJobFailureResult, which provides details of a job failure, and
//
// PutJobSuccessResult, which provides details of a job success.
//
// Third party jobs, which are instances of an action created by a partner
// action and integrated into AWS CodePipeline. Partner actions are created
// by members of the AWS Partner Network.
//
// You can work with third party jobs by calling:
//
// AcknowledgeThirdPartyJob, which confirms whether a job worker has received
// the specified job,
//
// GetThirdPartyJobDetails, which requests the details of a job for a partner
// action,
//
// PollForThirdPartyJobs, which determines whether there are any jobs to
// act upon,
//
// PutThirdPartyJobFailureResult, which provides details of a job failure,
// and
//
// PutThirdPartyJobSuccessResult, which provides details of a job success.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CodePipeline struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "codepipeline"
// New creates a new instance of the CodePipeline client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CodePipeline client from just a session.
// svc := codepipeline.New(mySession)
//
// // Create a CodePipeline client with additional configuration
// svc := codepipeline.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CodePipeline {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CodePipeline {
svc := &CodePipeline{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-07-09",
JSONVersion: "1.1",
TargetPrefix: "CodePipeline_20150709",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CodePipeline operation and runs any
// custom request initialization.
func (c *CodePipeline) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,86 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cognitoidentityiface provides an interface for the Amazon Cognito Identity.
package cognitoidentityiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cognitoidentity"
)
// CognitoIdentityAPI is the interface type for cognitoidentity.CognitoIdentity.
type CognitoIdentityAPI interface {
CreateIdentityPoolRequest(*cognitoidentity.CreateIdentityPoolInput) (*request.Request, *cognitoidentity.IdentityPool)
CreateIdentityPool(*cognitoidentity.CreateIdentityPoolInput) (*cognitoidentity.IdentityPool, error)
DeleteIdentitiesRequest(*cognitoidentity.DeleteIdentitiesInput) (*request.Request, *cognitoidentity.DeleteIdentitiesOutput)
DeleteIdentities(*cognitoidentity.DeleteIdentitiesInput) (*cognitoidentity.DeleteIdentitiesOutput, error)
DeleteIdentityPoolRequest(*cognitoidentity.DeleteIdentityPoolInput) (*request.Request, *cognitoidentity.DeleteIdentityPoolOutput)
DeleteIdentityPool(*cognitoidentity.DeleteIdentityPoolInput) (*cognitoidentity.DeleteIdentityPoolOutput, error)
DescribeIdentityRequest(*cognitoidentity.DescribeIdentityInput) (*request.Request, *cognitoidentity.IdentityDescription)
DescribeIdentity(*cognitoidentity.DescribeIdentityInput) (*cognitoidentity.IdentityDescription, error)
DescribeIdentityPoolRequest(*cognitoidentity.DescribeIdentityPoolInput) (*request.Request, *cognitoidentity.IdentityPool)
DescribeIdentityPool(*cognitoidentity.DescribeIdentityPoolInput) (*cognitoidentity.IdentityPool, error)
GetCredentialsForIdentityRequest(*cognitoidentity.GetCredentialsForIdentityInput) (*request.Request, *cognitoidentity.GetCredentialsForIdentityOutput)
GetCredentialsForIdentity(*cognitoidentity.GetCredentialsForIdentityInput) (*cognitoidentity.GetCredentialsForIdentityOutput, error)
GetIdRequest(*cognitoidentity.GetIdInput) (*request.Request, *cognitoidentity.GetIdOutput)
GetId(*cognitoidentity.GetIdInput) (*cognitoidentity.GetIdOutput, error)
GetIdentityPoolRolesRequest(*cognitoidentity.GetIdentityPoolRolesInput) (*request.Request, *cognitoidentity.GetIdentityPoolRolesOutput)
GetIdentityPoolRoles(*cognitoidentity.GetIdentityPoolRolesInput) (*cognitoidentity.GetIdentityPoolRolesOutput, error)
GetOpenIdTokenRequest(*cognitoidentity.GetOpenIdTokenInput) (*request.Request, *cognitoidentity.GetOpenIdTokenOutput)
GetOpenIdToken(*cognitoidentity.GetOpenIdTokenInput) (*cognitoidentity.GetOpenIdTokenOutput, error)
GetOpenIdTokenForDeveloperIdentityRequest(*cognitoidentity.GetOpenIdTokenForDeveloperIdentityInput) (*request.Request, *cognitoidentity.GetOpenIdTokenForDeveloperIdentityOutput)
GetOpenIdTokenForDeveloperIdentity(*cognitoidentity.GetOpenIdTokenForDeveloperIdentityInput) (*cognitoidentity.GetOpenIdTokenForDeveloperIdentityOutput, error)
ListIdentitiesRequest(*cognitoidentity.ListIdentitiesInput) (*request.Request, *cognitoidentity.ListIdentitiesOutput)
ListIdentities(*cognitoidentity.ListIdentitiesInput) (*cognitoidentity.ListIdentitiesOutput, error)
ListIdentityPoolsRequest(*cognitoidentity.ListIdentityPoolsInput) (*request.Request, *cognitoidentity.ListIdentityPoolsOutput)
ListIdentityPools(*cognitoidentity.ListIdentityPoolsInput) (*cognitoidentity.ListIdentityPoolsOutput, error)
LookupDeveloperIdentityRequest(*cognitoidentity.LookupDeveloperIdentityInput) (*request.Request, *cognitoidentity.LookupDeveloperIdentityOutput)
LookupDeveloperIdentity(*cognitoidentity.LookupDeveloperIdentityInput) (*cognitoidentity.LookupDeveloperIdentityOutput, error)
MergeDeveloperIdentitiesRequest(*cognitoidentity.MergeDeveloperIdentitiesInput) (*request.Request, *cognitoidentity.MergeDeveloperIdentitiesOutput)
MergeDeveloperIdentities(*cognitoidentity.MergeDeveloperIdentitiesInput) (*cognitoidentity.MergeDeveloperIdentitiesOutput, error)
SetIdentityPoolRolesRequest(*cognitoidentity.SetIdentityPoolRolesInput) (*request.Request, *cognitoidentity.SetIdentityPoolRolesOutput)
SetIdentityPoolRoles(*cognitoidentity.SetIdentityPoolRolesInput) (*cognitoidentity.SetIdentityPoolRolesOutput, error)
UnlinkDeveloperIdentityRequest(*cognitoidentity.UnlinkDeveloperIdentityInput) (*request.Request, *cognitoidentity.UnlinkDeveloperIdentityOutput)
UnlinkDeveloperIdentity(*cognitoidentity.UnlinkDeveloperIdentityInput) (*cognitoidentity.UnlinkDeveloperIdentityOutput, error)
UnlinkIdentityRequest(*cognitoidentity.UnlinkIdentityInput) (*request.Request, *cognitoidentity.UnlinkIdentityOutput)
UnlinkIdentity(*cognitoidentity.UnlinkIdentityInput) (*cognitoidentity.UnlinkIdentityOutput, error)
UpdateIdentityPoolRequest(*cognitoidentity.IdentityPool) (*request.Request, *cognitoidentity.IdentityPool)
UpdateIdentityPool(*cognitoidentity.IdentityPool) (*cognitoidentity.IdentityPool, error)
}
var _ CognitoIdentityAPI = (*cognitoidentity.CognitoIdentity)(nil)

View File

@@ -1,12 +0,0 @@
package cognitoidentity
import "github.com/aws/aws-sdk-go/aws/request"
func init() {
initRequest = func(r *request.Request) {
switch r.Operation.Name {
case opGetOpenIdToken, opGetId, opGetCredentialsForIdentity:
r.Handlers.Sign.Clear() // these operations are unsigned
}
}
}

View File

@@ -1,42 +0,0 @@
package cognitoidentity_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/cognitoidentity"
"github.com/stretchr/testify/assert"
)
var svc = cognitoidentity.New(unit.Session)
func TestUnsignedRequest_GetID(t *testing.T) {
req, _ := svc.GetIdRequest(&cognitoidentity.GetIdInput{
IdentityPoolId: aws.String("IdentityPoolId"),
})
err := req.Sign()
assert.NoError(t, err)
assert.Equal(t, "", req.HTTPRequest.Header.Get("Authorization"))
}
func TestUnsignedRequest_GetOpenIDToken(t *testing.T) {
req, _ := svc.GetOpenIdTokenRequest(&cognitoidentity.GetOpenIdTokenInput{
IdentityId: aws.String("IdentityId"),
})
err := req.Sign()
assert.NoError(t, err)
assert.Equal(t, "", req.HTTPRequest.Header.Get("Authorization"))
}
func TestUnsignedRequest_GetCredentialsForIdentity(t *testing.T) {
req, _ := svc.GetCredentialsForIdentityRequest(&cognitoidentity.GetCredentialsForIdentityInput{
IdentityId: aws.String("IdentityId"),
})
err := req.Sign()
assert.NoError(t, err)
assert.Equal(t, "", req.HTTPRequest.Header.Get("Authorization"))
}

View File

@@ -1,450 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitoidentity_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cognitoidentity"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCognitoIdentity_CreateIdentityPool() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.CreateIdentityPoolInput{
AllowUnauthenticatedIdentities: aws.Bool(true), // Required
IdentityPoolName: aws.String("IdentityPoolName"), // Required
CognitoIdentityProviders: []*cognitoidentity.Provider{
{ // Required
ClientId: aws.String("ProviderClientId"),
ProviderName: aws.String("ProviderName"),
},
// More values...
},
DeveloperProviderName: aws.String("DeveloperProviderName"),
OpenIdConnectProviderARNs: []*string{
aws.String("ARNString"), // Required
// More values...
},
SamlProviderARNs: []*string{
aws.String("ARNString"), // Required
// More values...
},
SupportedLoginProviders: map[string]*string{
"Key": aws.String("IdentityProviderId"), // Required
// More values...
},
}
resp, err := svc.CreateIdentityPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_DeleteIdentities() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.DeleteIdentitiesInput{
IdentityIdsToDelete: []*string{ // Required
aws.String("IdentityId"), // Required
// More values...
},
}
resp, err := svc.DeleteIdentities(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_DeleteIdentityPool() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.DeleteIdentityPoolInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DeleteIdentityPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_DescribeIdentity() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.DescribeIdentityInput{
IdentityId: aws.String("IdentityId"), // Required
}
resp, err := svc.DescribeIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_DescribeIdentityPool() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.DescribeIdentityPoolInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeIdentityPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_GetCredentialsForIdentity() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.GetCredentialsForIdentityInput{
IdentityId: aws.String("IdentityId"), // Required
CustomRoleArn: aws.String("ARNString"),
Logins: map[string]*string{
"Key": aws.String("IdentityProviderToken"), // Required
// More values...
},
}
resp, err := svc.GetCredentialsForIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_GetId() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.GetIdInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
AccountId: aws.String("AccountId"),
Logins: map[string]*string{
"Key": aws.String("IdentityProviderToken"), // Required
// More values...
},
}
resp, err := svc.GetId(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_GetIdentityPoolRoles() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.GetIdentityPoolRolesInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetIdentityPoolRoles(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_GetOpenIdToken() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.GetOpenIdTokenInput{
IdentityId: aws.String("IdentityId"), // Required
Logins: map[string]*string{
"Key": aws.String("IdentityProviderToken"), // Required
// More values...
},
}
resp, err := svc.GetOpenIdToken(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_GetOpenIdTokenForDeveloperIdentity() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.GetOpenIdTokenForDeveloperIdentityInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
Logins: map[string]*string{ // Required
"Key": aws.String("IdentityProviderToken"), // Required
// More values...
},
IdentityId: aws.String("IdentityId"),
TokenDuration: aws.Int64(1),
}
resp, err := svc.GetOpenIdTokenForDeveloperIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_ListIdentities() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.ListIdentitiesInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
MaxResults: aws.Int64(1), // Required
HideDisabled: aws.Bool(true),
NextToken: aws.String("PaginationKey"),
}
resp, err := svc.ListIdentities(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_ListIdentityPools() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.ListIdentityPoolsInput{
MaxResults: aws.Int64(1), // Required
NextToken: aws.String("PaginationKey"),
}
resp, err := svc.ListIdentityPools(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_LookupDeveloperIdentity() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.LookupDeveloperIdentityInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
DeveloperUserIdentifier: aws.String("DeveloperUserIdentifier"),
IdentityId: aws.String("IdentityId"),
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationKey"),
}
resp, err := svc.LookupDeveloperIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_MergeDeveloperIdentities() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.MergeDeveloperIdentitiesInput{
DestinationUserIdentifier: aws.String("DeveloperUserIdentifier"), // Required
DeveloperProviderName: aws.String("DeveloperProviderName"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
SourceUserIdentifier: aws.String("DeveloperUserIdentifier"), // Required
}
resp, err := svc.MergeDeveloperIdentities(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_SetIdentityPoolRoles() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.SetIdentityPoolRolesInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
Roles: map[string]*string{ // Required
"Key": aws.String("ARNString"), // Required
// More values...
},
}
resp, err := svc.SetIdentityPoolRoles(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_UnlinkDeveloperIdentity() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.UnlinkDeveloperIdentityInput{
DeveloperProviderName: aws.String("DeveloperProviderName"), // Required
DeveloperUserIdentifier: aws.String("DeveloperUserIdentifier"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.UnlinkDeveloperIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_UnlinkIdentity() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.UnlinkIdentityInput{
IdentityId: aws.String("IdentityId"), // Required
Logins: map[string]*string{ // Required
"Key": aws.String("IdentityProviderToken"), // Required
// More values...
},
LoginsToRemove: []*string{ // Required
aws.String("IdentityProviderName"), // Required
// More values...
},
}
resp, err := svc.UnlinkIdentity(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentity_UpdateIdentityPool() {
svc := cognitoidentity.New(session.New())
params := &cognitoidentity.IdentityPool{
AllowUnauthenticatedIdentities: aws.Bool(true), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
IdentityPoolName: aws.String("IdentityPoolName"), // Required
CognitoIdentityProviders: []*cognitoidentity.Provider{
{ // Required
ClientId: aws.String("ProviderClientId"),
ProviderName: aws.String("ProviderName"),
},
// More values...
},
DeveloperProviderName: aws.String("DeveloperProviderName"),
OpenIdConnectProviderARNs: []*string{
aws.String("ARNString"), // Required
// More values...
},
SamlProviderARNs: []*string{
aws.String("ARNString"), // Required
// More values...
},
SupportedLoginProviders: map[string]*string{
"Key": aws.String("IdentityProviderId"), // Required
// More values...
},
}
resp, err := svc.UpdateIdentityPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,119 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitoidentity
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Amazon Cognito is a web service that delivers scoped temporary credentials
// to mobile devices and other untrusted environments. Amazon Cognito uniquely
// identifies a device and supplies the user with a consistent identity over
// the lifetime of an application.
//
// Using Amazon Cognito, you can enable authentication with one or more third-party
// identity providers (Facebook, Google, or Login with Amazon), and you can
// also choose to support unauthenticated access from your app. Cognito delivers
// a unique identifier for each user and acts as an OpenID token provider trusted
// by AWS Security Token Service (STS) to access temporary, limited-privilege
// AWS credentials.
//
// To provide end-user credentials, first make an unsigned call to GetId. If
// the end user is authenticated with one of the supported identity providers,
// set the Logins map with the identity provider token. GetId returns a unique
// identifier for the user.
//
// Next, make an unsigned call to GetCredentialsForIdentity. This call expects
// the same Logins map as the GetId call, as well as the IdentityID originally
// returned by GetId. Assuming your identity pool has been configured via the
// SetIdentityPoolRoles operation, GetCredentialsForIdentity will return AWS
// credentials for your use. If your pool has not been configured with SetIdentityPoolRoles,
// or if you want to follow legacy flow, make an unsigned call to GetOpenIdToken,
// which returns the OpenID token necessary to call STS and retrieve AWS credentials.
// This call expects the same Logins map as the GetId call, as well as the IdentityID
// originally returned by GetId. The token returned by GetOpenIdToken can be
// passed to the STS operation AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html)
// to retrieve AWS credentials.
//
// If you want to use Amazon Cognito in an Android, iOS, or Unity application,
// you will probably want to make API calls via the AWS Mobile SDK. To learn
// more, see the AWS Mobile SDK Developer Guide (http://docs.aws.amazon.com/mobile/index.html).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CognitoIdentity struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cognito-identity"
// New creates a new instance of the CognitoIdentity client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CognitoIdentity client from just a session.
// svc := cognitoidentity.New(mySession)
//
// // Create a CognitoIdentity client with additional configuration
// svc := cognitoidentity.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CognitoIdentity {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CognitoIdentity {
svc := &CognitoIdentity{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2014-06-30",
JSONVersion: "1.1",
TargetPrefix: "AWSCognitoIdentityService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CognitoIdentity operation and runs any
// custom request initialization.
func (c *CognitoIdentity) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,150 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cognitoidentityprovideriface provides an interface for the Amazon Cognito Identity Provider.
package cognitoidentityprovideriface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
)
// CognitoIdentityProviderAPI is the interface type for cognitoidentityprovider.CognitoIdentityProvider.
type CognitoIdentityProviderAPI interface {
AddCustomAttributesRequest(*cognitoidentityprovider.AddCustomAttributesInput) (*request.Request, *cognitoidentityprovider.AddCustomAttributesOutput)
AddCustomAttributes(*cognitoidentityprovider.AddCustomAttributesInput) (*cognitoidentityprovider.AddCustomAttributesOutput, error)
AdminConfirmSignUpRequest(*cognitoidentityprovider.AdminConfirmSignUpInput) (*request.Request, *cognitoidentityprovider.AdminConfirmSignUpOutput)
AdminConfirmSignUp(*cognitoidentityprovider.AdminConfirmSignUpInput) (*cognitoidentityprovider.AdminConfirmSignUpOutput, error)
AdminDeleteUserRequest(*cognitoidentityprovider.AdminDeleteUserInput) (*request.Request, *cognitoidentityprovider.AdminDeleteUserOutput)
AdminDeleteUser(*cognitoidentityprovider.AdminDeleteUserInput) (*cognitoidentityprovider.AdminDeleteUserOutput, error)
AdminDeleteUserAttributesRequest(*cognitoidentityprovider.AdminDeleteUserAttributesInput) (*request.Request, *cognitoidentityprovider.AdminDeleteUserAttributesOutput)
AdminDeleteUserAttributes(*cognitoidentityprovider.AdminDeleteUserAttributesInput) (*cognitoidentityprovider.AdminDeleteUserAttributesOutput, error)
AdminDisableUserRequest(*cognitoidentityprovider.AdminDisableUserInput) (*request.Request, *cognitoidentityprovider.AdminDisableUserOutput)
AdminDisableUser(*cognitoidentityprovider.AdminDisableUserInput) (*cognitoidentityprovider.AdminDisableUserOutput, error)
AdminEnableUserRequest(*cognitoidentityprovider.AdminEnableUserInput) (*request.Request, *cognitoidentityprovider.AdminEnableUserOutput)
AdminEnableUser(*cognitoidentityprovider.AdminEnableUserInput) (*cognitoidentityprovider.AdminEnableUserOutput, error)
AdminGetUserRequest(*cognitoidentityprovider.AdminGetUserInput) (*request.Request, *cognitoidentityprovider.AdminGetUserOutput)
AdminGetUser(*cognitoidentityprovider.AdminGetUserInput) (*cognitoidentityprovider.AdminGetUserOutput, error)
AdminResetUserPasswordRequest(*cognitoidentityprovider.AdminResetUserPasswordInput) (*request.Request, *cognitoidentityprovider.AdminResetUserPasswordOutput)
AdminResetUserPassword(*cognitoidentityprovider.AdminResetUserPasswordInput) (*cognitoidentityprovider.AdminResetUserPasswordOutput, error)
AdminSetUserSettingsRequest(*cognitoidentityprovider.AdminSetUserSettingsInput) (*request.Request, *cognitoidentityprovider.AdminSetUserSettingsOutput)
AdminSetUserSettings(*cognitoidentityprovider.AdminSetUserSettingsInput) (*cognitoidentityprovider.AdminSetUserSettingsOutput, error)
AdminUpdateUserAttributesRequest(*cognitoidentityprovider.AdminUpdateUserAttributesInput) (*request.Request, *cognitoidentityprovider.AdminUpdateUserAttributesOutput)
AdminUpdateUserAttributes(*cognitoidentityprovider.AdminUpdateUserAttributesInput) (*cognitoidentityprovider.AdminUpdateUserAttributesOutput, error)
ChangePasswordRequest(*cognitoidentityprovider.ChangePasswordInput) (*request.Request, *cognitoidentityprovider.ChangePasswordOutput)
ChangePassword(*cognitoidentityprovider.ChangePasswordInput) (*cognitoidentityprovider.ChangePasswordOutput, error)
ConfirmForgotPasswordRequest(*cognitoidentityprovider.ConfirmForgotPasswordInput) (*request.Request, *cognitoidentityprovider.ConfirmForgotPasswordOutput)
ConfirmForgotPassword(*cognitoidentityprovider.ConfirmForgotPasswordInput) (*cognitoidentityprovider.ConfirmForgotPasswordOutput, error)
ConfirmSignUpRequest(*cognitoidentityprovider.ConfirmSignUpInput) (*request.Request, *cognitoidentityprovider.ConfirmSignUpOutput)
ConfirmSignUp(*cognitoidentityprovider.ConfirmSignUpInput) (*cognitoidentityprovider.ConfirmSignUpOutput, error)
CreateUserPoolRequest(*cognitoidentityprovider.CreateUserPoolInput) (*request.Request, *cognitoidentityprovider.CreateUserPoolOutput)
CreateUserPool(*cognitoidentityprovider.CreateUserPoolInput) (*cognitoidentityprovider.CreateUserPoolOutput, error)
CreateUserPoolClientRequest(*cognitoidentityprovider.CreateUserPoolClientInput) (*request.Request, *cognitoidentityprovider.CreateUserPoolClientOutput)
CreateUserPoolClient(*cognitoidentityprovider.CreateUserPoolClientInput) (*cognitoidentityprovider.CreateUserPoolClientOutput, error)
DeleteUserRequest(*cognitoidentityprovider.DeleteUserInput) (*request.Request, *cognitoidentityprovider.DeleteUserOutput)
DeleteUser(*cognitoidentityprovider.DeleteUserInput) (*cognitoidentityprovider.DeleteUserOutput, error)
DeleteUserAttributesRequest(*cognitoidentityprovider.DeleteUserAttributesInput) (*request.Request, *cognitoidentityprovider.DeleteUserAttributesOutput)
DeleteUserAttributes(*cognitoidentityprovider.DeleteUserAttributesInput) (*cognitoidentityprovider.DeleteUserAttributesOutput, error)
DeleteUserPoolRequest(*cognitoidentityprovider.DeleteUserPoolInput) (*request.Request, *cognitoidentityprovider.DeleteUserPoolOutput)
DeleteUserPool(*cognitoidentityprovider.DeleteUserPoolInput) (*cognitoidentityprovider.DeleteUserPoolOutput, error)
DeleteUserPoolClientRequest(*cognitoidentityprovider.DeleteUserPoolClientInput) (*request.Request, *cognitoidentityprovider.DeleteUserPoolClientOutput)
DeleteUserPoolClient(*cognitoidentityprovider.DeleteUserPoolClientInput) (*cognitoidentityprovider.DeleteUserPoolClientOutput, error)
DescribeUserPoolRequest(*cognitoidentityprovider.DescribeUserPoolInput) (*request.Request, *cognitoidentityprovider.DescribeUserPoolOutput)
DescribeUserPool(*cognitoidentityprovider.DescribeUserPoolInput) (*cognitoidentityprovider.DescribeUserPoolOutput, error)
DescribeUserPoolClientRequest(*cognitoidentityprovider.DescribeUserPoolClientInput) (*request.Request, *cognitoidentityprovider.DescribeUserPoolClientOutput)
DescribeUserPoolClient(*cognitoidentityprovider.DescribeUserPoolClientInput) (*cognitoidentityprovider.DescribeUserPoolClientOutput, error)
ForgotPasswordRequest(*cognitoidentityprovider.ForgotPasswordInput) (*request.Request, *cognitoidentityprovider.ForgotPasswordOutput)
ForgotPassword(*cognitoidentityprovider.ForgotPasswordInput) (*cognitoidentityprovider.ForgotPasswordOutput, error)
GetUserRequest(*cognitoidentityprovider.GetUserInput) (*request.Request, *cognitoidentityprovider.GetUserOutput)
GetUser(*cognitoidentityprovider.GetUserInput) (*cognitoidentityprovider.GetUserOutput, error)
GetUserAttributeVerificationCodeRequest(*cognitoidentityprovider.GetUserAttributeVerificationCodeInput) (*request.Request, *cognitoidentityprovider.GetUserAttributeVerificationCodeOutput)
GetUserAttributeVerificationCode(*cognitoidentityprovider.GetUserAttributeVerificationCodeInput) (*cognitoidentityprovider.GetUserAttributeVerificationCodeOutput, error)
ListUserPoolClientsRequest(*cognitoidentityprovider.ListUserPoolClientsInput) (*request.Request, *cognitoidentityprovider.ListUserPoolClientsOutput)
ListUserPoolClients(*cognitoidentityprovider.ListUserPoolClientsInput) (*cognitoidentityprovider.ListUserPoolClientsOutput, error)
ListUserPoolsRequest(*cognitoidentityprovider.ListUserPoolsInput) (*request.Request, *cognitoidentityprovider.ListUserPoolsOutput)
ListUserPools(*cognitoidentityprovider.ListUserPoolsInput) (*cognitoidentityprovider.ListUserPoolsOutput, error)
ListUsersRequest(*cognitoidentityprovider.ListUsersInput) (*request.Request, *cognitoidentityprovider.ListUsersOutput)
ListUsers(*cognitoidentityprovider.ListUsersInput) (*cognitoidentityprovider.ListUsersOutput, error)
ResendConfirmationCodeRequest(*cognitoidentityprovider.ResendConfirmationCodeInput) (*request.Request, *cognitoidentityprovider.ResendConfirmationCodeOutput)
ResendConfirmationCode(*cognitoidentityprovider.ResendConfirmationCodeInput) (*cognitoidentityprovider.ResendConfirmationCodeOutput, error)
SetUserSettingsRequest(*cognitoidentityprovider.SetUserSettingsInput) (*request.Request, *cognitoidentityprovider.SetUserSettingsOutput)
SetUserSettings(*cognitoidentityprovider.SetUserSettingsInput) (*cognitoidentityprovider.SetUserSettingsOutput, error)
SignUpRequest(*cognitoidentityprovider.SignUpInput) (*request.Request, *cognitoidentityprovider.SignUpOutput)
SignUp(*cognitoidentityprovider.SignUpInput) (*cognitoidentityprovider.SignUpOutput, error)
UpdateUserAttributesRequest(*cognitoidentityprovider.UpdateUserAttributesInput) (*request.Request, *cognitoidentityprovider.UpdateUserAttributesOutput)
UpdateUserAttributes(*cognitoidentityprovider.UpdateUserAttributesInput) (*cognitoidentityprovider.UpdateUserAttributesOutput, error)
UpdateUserPoolRequest(*cognitoidentityprovider.UpdateUserPoolInput) (*request.Request, *cognitoidentityprovider.UpdateUserPoolOutput)
UpdateUserPool(*cognitoidentityprovider.UpdateUserPoolInput) (*cognitoidentityprovider.UpdateUserPoolOutput, error)
UpdateUserPoolClientRequest(*cognitoidentityprovider.UpdateUserPoolClientInput) (*request.Request, *cognitoidentityprovider.UpdateUserPoolClientOutput)
UpdateUserPoolClient(*cognitoidentityprovider.UpdateUserPoolClientInput) (*cognitoidentityprovider.UpdateUserPoolClientOutput, error)
VerifyUserAttributeRequest(*cognitoidentityprovider.VerifyUserAttributeInput) (*request.Request, *cognitoidentityprovider.VerifyUserAttributeOutput)
VerifyUserAttribute(*cognitoidentityprovider.VerifyUserAttributeInput) (*cognitoidentityprovider.VerifyUserAttributeOutput, error)
}
var _ CognitoIdentityProviderAPI = (*cognitoidentityprovider.CognitoIdentityProvider)(nil)

View File

@@ -1,829 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitoidentityprovider_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCognitoIdentityProvider_AddCustomAttributes() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AddCustomAttributesInput{
CustomAttributes: []*cognitoidentityprovider.SchemaAttributeType{ // Required
{ // Required
AttributeDataType: aws.String("AttributeDataType"),
DeveloperOnlyAttribute: aws.Bool(true),
Mutable: aws.Bool(true),
Name: aws.String("CustomAttributeNameType"),
NumberAttributeConstraints: &cognitoidentityprovider.NumberAttributeConstraintsType{
MaxValue: aws.String("StringType"),
MinValue: aws.String("StringType"),
},
Required: aws.Bool(true),
StringAttributeConstraints: &cognitoidentityprovider.StringAttributeConstraintsType{
MaxLength: aws.String("StringType"),
MinLength: aws.String("StringType"),
},
},
// More values...
},
UserPoolId: aws.String("UserPoolIdType"), // Required
}
resp, err := svc.AddCustomAttributes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminConfirmSignUp() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminConfirmSignUpInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminConfirmSignUp(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminDeleteUser() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminDeleteUserInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminDeleteUser(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminDeleteUserAttributes() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminDeleteUserAttributesInput{
UserAttributeNames: []*string{ // Required
aws.String("AttributeNameType"), // Required
// More values...
},
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminDeleteUserAttributes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminDisableUser() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminDisableUserInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminDisableUser(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminEnableUser() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminEnableUserInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminEnableUser(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminGetUser() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminGetUserInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminGetUser(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminResetUserPassword() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminResetUserPasswordInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminResetUserPassword(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminSetUserSettings() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminSetUserSettingsInput{
MFAOptions: []*cognitoidentityprovider.MFAOptionType{ // Required
{ // Required
AttributeName: aws.String("AttributeNameType"),
DeliveryMedium: aws.String("DeliveryMediumType"),
},
// More values...
},
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminSetUserSettings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_AdminUpdateUserAttributes() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.AdminUpdateUserAttributesInput{
UserAttributes: []*cognitoidentityprovider.AttributeType{ // Required
{ // Required
Name: aws.String("AttributeNameType"), // Required
Value: aws.String("AttributeValueType"),
},
// More values...
},
UserPoolId: aws.String("UserPoolIdType"), // Required
Username: aws.String("UsernameType"), // Required
}
resp, err := svc.AdminUpdateUserAttributes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ChangePassword() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ChangePasswordInput{
PreviousPassword: aws.String("PasswordType"), // Required
ProposedPassword: aws.String("PasswordType"), // Required
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.ChangePassword(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ConfirmForgotPassword() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ConfirmForgotPasswordInput{
ClientId: aws.String("ClientIdType"), // Required
ConfirmationCode: aws.String("ConfirmationCodeType"), // Required
Password: aws.String("PasswordType"), // Required
Username: aws.String("UsernameType"), // Required
SecretHash: aws.String("SecretHashType"),
}
resp, err := svc.ConfirmForgotPassword(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ConfirmSignUp() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ConfirmSignUpInput{
ClientId: aws.String("ClientIdType"), // Required
ConfirmationCode: aws.String("ConfirmationCodeType"), // Required
Username: aws.String("UsernameType"), // Required
ForceAliasCreation: aws.Bool(true),
SecretHash: aws.String("SecretHashType"),
}
resp, err := svc.ConfirmSignUp(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_CreateUserPool() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.CreateUserPoolInput{
PoolName: aws.String("UserPoolNameType"), // Required
AliasAttributes: []*string{
aws.String("AliasAttributeType"), // Required
// More values...
},
AutoVerifiedAttributes: []*string{
aws.String("VerifiedAttributeType"), // Required
// More values...
},
EmailVerificationMessage: aws.String("EmailVerificationMessageType"),
EmailVerificationSubject: aws.String("EmailVerificationSubjectType"),
LambdaConfig: &cognitoidentityprovider.LambdaConfigType{
CustomMessage: aws.String("ArnType"),
PostAuthentication: aws.String("ArnType"),
PostConfirmation: aws.String("ArnType"),
PreAuthentication: aws.String("ArnType"),
PreSignUp: aws.String("ArnType"),
},
MfaConfiguration: aws.String("UserPoolMfaType"),
Policies: &cognitoidentityprovider.UserPoolPolicyType{
PasswordPolicy: &cognitoidentityprovider.PasswordPolicyType{
MinimumLength: aws.Int64(1),
RequireLowercase: aws.Bool(true),
RequireNumbers: aws.Bool(true),
RequireSymbols: aws.Bool(true),
RequireUppercase: aws.Bool(true),
},
},
SmsAuthenticationMessage: aws.String("SmsVerificationMessageType"),
SmsVerificationMessage: aws.String("SmsVerificationMessageType"),
}
resp, err := svc.CreateUserPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_CreateUserPoolClient() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.CreateUserPoolClientInput{
ClientName: aws.String("ClientNameType"), // Required
UserPoolId: aws.String("UserPoolIdType"), // Required
GenerateSecret: aws.Bool(true),
}
resp, err := svc.CreateUserPoolClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_DeleteUser() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.DeleteUserInput{
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.DeleteUser(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_DeleteUserAttributes() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.DeleteUserAttributesInput{
UserAttributeNames: []*string{ // Required
aws.String("AttributeNameType"), // Required
// More values...
},
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.DeleteUserAttributes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_DeleteUserPool() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.DeleteUserPoolInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
}
resp, err := svc.DeleteUserPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_DeleteUserPoolClient() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.DeleteUserPoolClientInput{
ClientId: aws.String("ClientIdType"), // Required
UserPoolId: aws.String("UserPoolIdType"), // Required
}
resp, err := svc.DeleteUserPoolClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_DescribeUserPool() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.DescribeUserPoolInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
}
resp, err := svc.DescribeUserPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_DescribeUserPoolClient() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.DescribeUserPoolClientInput{
ClientId: aws.String("ClientIdType"), // Required
UserPoolId: aws.String("UserPoolIdType"), // Required
}
resp, err := svc.DescribeUserPoolClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ForgotPassword() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ForgotPasswordInput{
ClientId: aws.String("ClientIdType"), // Required
Username: aws.String("UsernameType"), // Required
SecretHash: aws.String("SecretHashType"),
}
resp, err := svc.ForgotPassword(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_GetUser() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.GetUserInput{
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.GetUser(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_GetUserAttributeVerificationCode() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.GetUserAttributeVerificationCodeInput{
AttributeName: aws.String("AttributeNameType"), // Required
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.GetUserAttributeVerificationCode(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ListUserPoolClients() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ListUserPoolClientsInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationKey"),
}
resp, err := svc.ListUserPoolClients(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ListUserPools() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ListUserPoolsInput{
MaxResults: aws.Int64(1), // Required
NextToken: aws.String("PaginationKeyType"),
}
resp, err := svc.ListUserPools(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ListUsers() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ListUsersInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
AttributesToGet: []*string{
aws.String("AttributeNameType"), // Required
// More values...
},
Limit: aws.Int64(1),
PaginationToken: aws.String("SearchPaginationTokenType"),
UserStatus: aws.String("UserStatusType"),
}
resp, err := svc.ListUsers(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_ResendConfirmationCode() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.ResendConfirmationCodeInput{
ClientId: aws.String("ClientIdType"), // Required
Username: aws.String("UsernameType"), // Required
SecretHash: aws.String("SecretHashType"),
}
resp, err := svc.ResendConfirmationCode(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_SetUserSettings() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.SetUserSettingsInput{
AccessToken: aws.String("TokenModelType"), // Required
MFAOptions: []*cognitoidentityprovider.MFAOptionType{ // Required
{ // Required
AttributeName: aws.String("AttributeNameType"),
DeliveryMedium: aws.String("DeliveryMediumType"),
},
// More values...
},
}
resp, err := svc.SetUserSettings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_SignUp() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.SignUpInput{
ClientId: aws.String("ClientIdType"), // Required
Password: aws.String("PasswordType"), // Required
Username: aws.String("UsernameType"), // Required
SecretHash: aws.String("SecretHashType"),
UserAttributes: []*cognitoidentityprovider.AttributeType{
{ // Required
Name: aws.String("AttributeNameType"), // Required
Value: aws.String("AttributeValueType"),
},
// More values...
},
ValidationData: []*cognitoidentityprovider.AttributeType{
{ // Required
Name: aws.String("AttributeNameType"), // Required
Value: aws.String("AttributeValueType"),
},
// More values...
},
}
resp, err := svc.SignUp(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_UpdateUserAttributes() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.UpdateUserAttributesInput{
UserAttributes: []*cognitoidentityprovider.AttributeType{ // Required
{ // Required
Name: aws.String("AttributeNameType"), // Required
Value: aws.String("AttributeValueType"),
},
// More values...
},
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.UpdateUserAttributes(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_UpdateUserPool() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.UpdateUserPoolInput{
UserPoolId: aws.String("UserPoolIdType"), // Required
AutoVerifiedAttributes: []*string{
aws.String("VerifiedAttributeType"), // Required
// More values...
},
EmailVerificationMessage: aws.String("EmailVerificationMessageType"),
EmailVerificationSubject: aws.String("EmailVerificationSubjectType"),
LambdaConfig: &cognitoidentityprovider.LambdaConfigType{
CustomMessage: aws.String("ArnType"),
PostAuthentication: aws.String("ArnType"),
PostConfirmation: aws.String("ArnType"),
PreAuthentication: aws.String("ArnType"),
PreSignUp: aws.String("ArnType"),
},
MfaConfiguration: aws.String("UserPoolMfaType"),
Policies: &cognitoidentityprovider.UserPoolPolicyType{
PasswordPolicy: &cognitoidentityprovider.PasswordPolicyType{
MinimumLength: aws.Int64(1),
RequireLowercase: aws.Bool(true),
RequireNumbers: aws.Bool(true),
RequireSymbols: aws.Bool(true),
RequireUppercase: aws.Bool(true),
},
},
SmsAuthenticationMessage: aws.String("SmsVerificationMessageType"),
SmsVerificationMessage: aws.String("SmsVerificationMessageType"),
}
resp, err := svc.UpdateUserPool(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_UpdateUserPoolClient() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.UpdateUserPoolClientInput{
ClientId: aws.String("ClientIdType"), // Required
UserPoolId: aws.String("UserPoolIdType"), // Required
ClientName: aws.String("ClientNameType"),
}
resp, err := svc.UpdateUserPoolClient(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoIdentityProvider_VerifyUserAttribute() {
svc := cognitoidentityprovider.New(session.New())
params := &cognitoidentityprovider.VerifyUserAttributeInput{
AttributeName: aws.String("AttributeNameType"), // Required
Code: aws.String("ConfirmationCodeType"), // Required
AccessToken: aws.String("TokenModelType"),
}
resp, err := svc.VerifyUserAttribute(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,93 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitoidentityprovider
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// You can create a user pool in Amazon Cognito Identity to manage directories
// and users. You can authenticate a user to obtain tokens related to user identity
// and access policies.
//
// This API reference provides information about user pools in Amazon Cognito
// Identity, which is a new capability that is available as a beta.
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CognitoIdentityProvider struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cognito-idp"
// New creates a new instance of the CognitoIdentityProvider client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CognitoIdentityProvider client from just a session.
// svc := cognitoidentityprovider.New(mySession)
//
// // Create a CognitoIdentityProvider client with additional configuration
// svc := cognitoidentityprovider.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CognitoIdentityProvider {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CognitoIdentityProvider {
svc := &CognitoIdentityProvider{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-04-18",
JSONVersion: "1.1",
TargetPrefix: "AWSCognitoIdentityProviderService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CognitoIdentityProvider operation and runs any
// custom request initialization.
func (c *CognitoIdentityProvider) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,82 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cognitosynciface provides an interface for the Amazon Cognito Sync.
package cognitosynciface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cognitosync"
)
// CognitoSyncAPI is the interface type for cognitosync.CognitoSync.
type CognitoSyncAPI interface {
BulkPublishRequest(*cognitosync.BulkPublishInput) (*request.Request, *cognitosync.BulkPublishOutput)
BulkPublish(*cognitosync.BulkPublishInput) (*cognitosync.BulkPublishOutput, error)
DeleteDatasetRequest(*cognitosync.DeleteDatasetInput) (*request.Request, *cognitosync.DeleteDatasetOutput)
DeleteDataset(*cognitosync.DeleteDatasetInput) (*cognitosync.DeleteDatasetOutput, error)
DescribeDatasetRequest(*cognitosync.DescribeDatasetInput) (*request.Request, *cognitosync.DescribeDatasetOutput)
DescribeDataset(*cognitosync.DescribeDatasetInput) (*cognitosync.DescribeDatasetOutput, error)
DescribeIdentityPoolUsageRequest(*cognitosync.DescribeIdentityPoolUsageInput) (*request.Request, *cognitosync.DescribeIdentityPoolUsageOutput)
DescribeIdentityPoolUsage(*cognitosync.DescribeIdentityPoolUsageInput) (*cognitosync.DescribeIdentityPoolUsageOutput, error)
DescribeIdentityUsageRequest(*cognitosync.DescribeIdentityUsageInput) (*request.Request, *cognitosync.DescribeIdentityUsageOutput)
DescribeIdentityUsage(*cognitosync.DescribeIdentityUsageInput) (*cognitosync.DescribeIdentityUsageOutput, error)
GetBulkPublishDetailsRequest(*cognitosync.GetBulkPublishDetailsInput) (*request.Request, *cognitosync.GetBulkPublishDetailsOutput)
GetBulkPublishDetails(*cognitosync.GetBulkPublishDetailsInput) (*cognitosync.GetBulkPublishDetailsOutput, error)
GetCognitoEventsRequest(*cognitosync.GetCognitoEventsInput) (*request.Request, *cognitosync.GetCognitoEventsOutput)
GetCognitoEvents(*cognitosync.GetCognitoEventsInput) (*cognitosync.GetCognitoEventsOutput, error)
GetIdentityPoolConfigurationRequest(*cognitosync.GetIdentityPoolConfigurationInput) (*request.Request, *cognitosync.GetIdentityPoolConfigurationOutput)
GetIdentityPoolConfiguration(*cognitosync.GetIdentityPoolConfigurationInput) (*cognitosync.GetIdentityPoolConfigurationOutput, error)
ListDatasetsRequest(*cognitosync.ListDatasetsInput) (*request.Request, *cognitosync.ListDatasetsOutput)
ListDatasets(*cognitosync.ListDatasetsInput) (*cognitosync.ListDatasetsOutput, error)
ListIdentityPoolUsageRequest(*cognitosync.ListIdentityPoolUsageInput) (*request.Request, *cognitosync.ListIdentityPoolUsageOutput)
ListIdentityPoolUsage(*cognitosync.ListIdentityPoolUsageInput) (*cognitosync.ListIdentityPoolUsageOutput, error)
ListRecordsRequest(*cognitosync.ListRecordsInput) (*request.Request, *cognitosync.ListRecordsOutput)
ListRecords(*cognitosync.ListRecordsInput) (*cognitosync.ListRecordsOutput, error)
RegisterDeviceRequest(*cognitosync.RegisterDeviceInput) (*request.Request, *cognitosync.RegisterDeviceOutput)
RegisterDevice(*cognitosync.RegisterDeviceInput) (*cognitosync.RegisterDeviceOutput, error)
SetCognitoEventsRequest(*cognitosync.SetCognitoEventsInput) (*request.Request, *cognitosync.SetCognitoEventsOutput)
SetCognitoEvents(*cognitosync.SetCognitoEventsInput) (*cognitosync.SetCognitoEventsOutput, error)
SetIdentityPoolConfigurationRequest(*cognitosync.SetIdentityPoolConfigurationInput) (*request.Request, *cognitosync.SetIdentityPoolConfigurationOutput)
SetIdentityPoolConfiguration(*cognitosync.SetIdentityPoolConfigurationInput) (*cognitosync.SetIdentityPoolConfigurationOutput, error)
SubscribeToDatasetRequest(*cognitosync.SubscribeToDatasetInput) (*request.Request, *cognitosync.SubscribeToDatasetOutput)
SubscribeToDataset(*cognitosync.SubscribeToDatasetInput) (*cognitosync.SubscribeToDatasetOutput, error)
UnsubscribeFromDatasetRequest(*cognitosync.UnsubscribeFromDatasetInput) (*request.Request, *cognitosync.UnsubscribeFromDatasetOutput)
UnsubscribeFromDataset(*cognitosync.UnsubscribeFromDatasetInput) (*cognitosync.UnsubscribeFromDatasetOutput, error)
UpdateRecordsRequest(*cognitosync.UpdateRecordsInput) (*request.Request, *cognitosync.UpdateRecordsOutput)
UpdateRecords(*cognitosync.UpdateRecordsInput) (*cognitosync.UpdateRecordsOutput, error)
}
var _ CognitoSyncAPI = (*cognitosync.CognitoSync)(nil)

View File

@@ -1,394 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitosync_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cognitosync"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCognitoSync_BulkPublish() {
svc := cognitosync.New(session.New())
params := &cognitosync.BulkPublishInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.BulkPublish(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_DeleteDataset() {
svc := cognitosync.New(session.New())
params := &cognitosync.DeleteDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DeleteDataset(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_DescribeDataset() {
svc := cognitosync.New(session.New())
params := &cognitosync.DescribeDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeDataset(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_DescribeIdentityPoolUsage() {
svc := cognitosync.New(session.New())
params := &cognitosync.DescribeIdentityPoolUsageInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeIdentityPoolUsage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_DescribeIdentityUsage() {
svc := cognitosync.New(session.New())
params := &cognitosync.DescribeIdentityUsageInput{
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeIdentityUsage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_GetBulkPublishDetails() {
svc := cognitosync.New(session.New())
params := &cognitosync.GetBulkPublishDetailsInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetBulkPublishDetails(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_GetCognitoEvents() {
svc := cognitosync.New(session.New())
params := &cognitosync.GetCognitoEventsInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetCognitoEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_GetIdentityPoolConfiguration() {
svc := cognitosync.New(session.New())
params := &cognitosync.GetIdentityPoolConfigurationInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetIdentityPoolConfiguration(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_ListDatasets() {
svc := cognitosync.New(session.New())
params := &cognitosync.ListDatasetsInput{
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListDatasets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_ListIdentityPoolUsage() {
svc := cognitosync.New(session.New())
params := &cognitosync.ListIdentityPoolUsageInput{
MaxResults: aws.Int64(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListIdentityPoolUsage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_ListRecords() {
svc := cognitosync.New(session.New())
params := &cognitosync.ListRecordsInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
LastSyncCount: aws.Int64(1),
MaxResults: aws.Int64(1),
NextToken: aws.String("String"),
SyncSessionToken: aws.String("SyncSessionToken"),
}
resp, err := svc.ListRecords(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_RegisterDevice() {
svc := cognitosync.New(session.New())
params := &cognitosync.RegisterDeviceInput{
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
Platform: aws.String("Platform"), // Required
Token: aws.String("PushToken"), // Required
}
resp, err := svc.RegisterDevice(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_SetCognitoEvents() {
svc := cognitosync.New(session.New())
params := &cognitosync.SetCognitoEventsInput{
Events: map[string]*string{ // Required
"Key": aws.String("LambdaFunctionArn"), // Required
// More values...
},
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.SetCognitoEvents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_SetIdentityPoolConfiguration() {
svc := cognitosync.New(session.New())
params := &cognitosync.SetIdentityPoolConfigurationInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
CognitoStreams: &cognitosync.CognitoStreams{
RoleArn: aws.String("AssumeRoleArn"),
StreamName: aws.String("StreamName"),
StreamingStatus: aws.String("StreamingStatus"),
},
PushSync: &cognitosync.PushSync{
ApplicationArns: []*string{
aws.String("ApplicationArn"), // Required
// More values...
},
RoleArn: aws.String("AssumeRoleArn"),
},
}
resp, err := svc.SetIdentityPoolConfiguration(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_SubscribeToDataset() {
svc := cognitosync.New(session.New())
params := &cognitosync.SubscribeToDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
DeviceId: aws.String("DeviceId"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.SubscribeToDataset(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_UnsubscribeFromDataset() {
svc := cognitosync.New(session.New())
params := &cognitosync.UnsubscribeFromDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
DeviceId: aws.String("DeviceId"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.UnsubscribeFromDataset(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleCognitoSync_UpdateRecords() {
svc := cognitosync.New(session.New())
params := &cognitosync.UpdateRecordsInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
SyncSessionToken: aws.String("SyncSessionToken"), // Required
ClientContext: aws.String("ClientContext"),
DeviceId: aws.String("DeviceId"),
RecordPatches: []*cognitosync.RecordPatch{
{ // Required
Key: aws.String("RecordKey"), // Required
Op: aws.String("Operation"), // Required
SyncCount: aws.Int64(1), // Required
DeviceLastModifiedDate: aws.Time(time.Now()),
Value: aws.String("RecordValue"),
},
// More values...
},
}
resp, err := svc.UpdateRecords(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View File

@@ -1,103 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitosync
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// Amazon Cognito Sync provides an AWS service and client library that enable
// cross-device syncing of application-related user data. High-level client
// libraries are available for both iOS and Android. You can use these libraries
// to persist data locally so that it's available even if the device is offline.
// Developer credentials don't need to be stored on the mobile device to access
// the service. You can use Amazon Cognito to obtain a normalized user ID and
// credentials. User data is persisted in a dataset that can store up to 1 MB
// of key-value pairs, and you can have up to 20 datasets per user identity.
//
// With Amazon Cognito Sync, the data stored for each identity is accessible
// only to credentials assigned to that identity. In order to use the Cognito
// Sync service, you need to make API calls using credentials retrieved with
// Amazon Cognito Identity service (http://docs.aws.amazon.com/cognitoidentity/latest/APIReference/Welcome.html).
//
// If you want to use Cognito Sync in an Android or iOS application, you will
// probably want to make API calls via the AWS Mobile SDK. To learn more, see
// the Developer Guide for Android (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-sync.html)
// and the Developer Guide for iOS (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-sync.html).
//The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
type CognitoSync struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// A ServiceName is the name of the service the client will make API calls to.
const ServiceName = "cognito-sync"
// New creates a new instance of the CognitoSync client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a CognitoSync client from just a session.
// svc := cognitosync.New(mySession)
//
// // Create a CognitoSync client with additional configuration
// svc := cognitosync.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CognitoSync {
c := p.ClientConfig(ServiceName, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CognitoSync {
svc := &CognitoSync{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2014-06-30",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a CognitoSync operation and runs any
// custom request initialization.
func (c *CognitoSync) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,112 +0,0 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package configserviceiface provides an interface for the AWS Config.
package configserviceiface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/configservice"
)
// ConfigServiceAPI is the interface type for configservice.ConfigService.
type ConfigServiceAPI interface {
DeleteConfigRuleRequest(*configservice.DeleteConfigRuleInput) (*request.Request, *configservice.DeleteConfigRuleOutput)
DeleteConfigRule(*configservice.DeleteConfigRuleInput) (*configservice.DeleteConfigRuleOutput, error)
DeleteConfigurationRecorderRequest(*configservice.DeleteConfigurationRecorderInput) (*request.Request, *configservice.DeleteConfigurationRecorderOutput)
DeleteConfigurationRecorder(*configservice.DeleteConfigurationRecorderInput) (*configservice.DeleteConfigurationRecorderOutput, error)
DeleteDeliveryChannelRequest(*configservice.DeleteDeliveryChannelInput) (*request.Request, *configservice.DeleteDeliveryChannelOutput)
DeleteDeliveryChannel(*configservice.DeleteDeliveryChannelInput) (*configservice.DeleteDeliveryChannelOutput, error)
DeliverConfigSnapshotRequest(*configservice.DeliverConfigSnapshotInput) (*request.Request, *configservice.DeliverConfigSnapshotOutput)
DeliverConfigSnapshot(*configservice.DeliverConfigSnapshotInput) (*configservice.DeliverConfigSnapshotOutput, error)
DescribeComplianceByConfigRuleRequest(*configservice.DescribeComplianceByConfigRuleInput) (*request.Request, *configservice.DescribeComplianceByConfigRuleOutput)
DescribeComplianceByConfigRule(*configservice.DescribeComplianceByConfigRuleInput) (*configservice.DescribeComplianceByConfigRuleOutput, error)
DescribeComplianceByResourceRequest(*configservice.DescribeComplianceByResourceInput) (*request.Request, *configservice.DescribeComplianceByResourceOutput)
DescribeComplianceByResource(*configservice.DescribeComplianceByResourceInput) (*configservice.DescribeComplianceByResourceOutput, error)
DescribeConfigRuleEvaluationStatusRequest(*configservice.DescribeConfigRuleEvaluationStatusInput) (*request.Request, *configservice.DescribeConfigRuleEvaluationStatusOutput)
DescribeConfigRuleEvaluationStatus(*configservice.DescribeConfigRuleEvaluationStatusInput) (*configservice.DescribeConfigRuleEvaluationStatusOutput, error)
DescribeConfigRulesRequest(*configservice.DescribeConfigRulesInput) (*request.Request, *configservice.DescribeConfigRulesOutput)
DescribeConfigRules(*configservice.DescribeConfigRulesInput) (*configservice.DescribeConfigRulesOutput, error)
DescribeConfigurationRecorderStatusRequest(*configservice.DescribeConfigurationRecorderStatusInput) (*request.Request, *configservice.DescribeConfigurationRecorderStatusOutput)
DescribeConfigurationRecorderStatus(*configservice.DescribeConfigurationRecorderStatusInput) (*configservice.DescribeConfigurationRecorderStatusOutput, error)
DescribeConfigurationRecordersRequest(*configservice.DescribeConfigurationRecordersInput) (*request.Request, *configservice.DescribeConfigurationRecordersOutput)
DescribeConfigurationRecorders(*configservice.DescribeConfigurationRecordersInput) (*configservice.DescribeConfigurationRecordersOutput, error)
DescribeDeliveryChannelStatusRequest(*configservice.DescribeDeliveryChannelStatusInput) (*request.Request, *configservice.DescribeDeliveryChannelStatusOutput)
DescribeDeliveryChannelStatus(*configservice.DescribeDeliveryChannelStatusInput) (*configservice.DescribeDeliveryChannelStatusOutput, error)
DescribeDeliveryChannelsRequest(*configservice.DescribeDeliveryChannelsInput) (*request.Request, *configservice.DescribeDeliveryChannelsOutput)
DescribeDeliveryChannels(*configservice.DescribeDeliveryChannelsInput) (*configservice.DescribeDeliveryChannelsOutput, error)
GetComplianceDetailsByConfigRuleRequest(*configservice.GetComplianceDetailsByConfigRuleInput) (*request.Request, *configservice.GetComplianceDetailsByConfigRuleOutput)
GetComplianceDetailsByConfigRule(*configservice.GetComplianceDetailsByConfigRuleInput) (*configservice.GetComplianceDetailsByConfigRuleOutput, error)
GetComplianceDetailsByResourceRequest(*configservice.GetComplianceDetailsByResourceInput) (*request.Request, *configservice.GetComplianceDetailsByResourceOutput)
GetComplianceDetailsByResource(*configservice.GetComplianceDetailsByResourceInput) (*configservice.GetComplianceDetailsByResourceOutput, error)
GetComplianceSummaryByConfigRuleRequest(*configservice.GetComplianceSummaryByConfigRuleInput) (*request.Request, *configservice.GetComplianceSummaryByConfigRuleOutput)
GetComplianceSummaryByConfigRule(*configservice.GetComplianceSummaryByConfigRuleInput) (*configservice.GetComplianceSummaryByConfigRuleOutput, error)
GetComplianceSummaryByResourceTypeRequest(*configservice.GetComplianceSummaryByResourceTypeInput) (*request.Request, *configservice.GetComplianceSummaryByResourceTypeOutput)
GetComplianceSummaryByResourceType(*configservice.GetComplianceSummaryByResourceTypeInput) (*configservice.GetComplianceSummaryByResourceTypeOutput, error)
GetResourceConfigHistoryRequest(*configservice.GetResourceConfigHistoryInput) (*request.Request, *configservice.GetResourceConfigHistoryOutput)
GetResourceConfigHistory(*configservice.GetResourceConfigHistoryInput) (*configservice.GetResourceConfigHistoryOutput, error)
GetResourceConfigHistoryPages(*configservice.GetResourceConfigHistoryInput, func(*configservice.GetResourceConfigHistoryOutput, bool) bool) error
ListDiscoveredResourcesRequest(*configservice.ListDiscoveredResourcesInput) (*request.Request, *configservice.ListDiscoveredResourcesOutput)
ListDiscoveredResources(*configservice.ListDiscoveredResourcesInput) (*configservice.ListDiscoveredResourcesOutput, error)
PutConfigRuleRequest(*configservice.PutConfigRuleInput) (*request.Request, *configservice.PutConfigRuleOutput)
PutConfigRule(*configservice.PutConfigRuleInput) (*configservice.PutConfigRuleOutput, error)
PutConfigurationRecorderRequest(*configservice.PutConfigurationRecorderInput) (*request.Request, *configservice.PutConfigurationRecorderOutput)
PutConfigurationRecorder(*configservice.PutConfigurationRecorderInput) (*configservice.PutConfigurationRecorderOutput, error)
PutDeliveryChannelRequest(*configservice.PutDeliveryChannelInput) (*request.Request, *configservice.PutDeliveryChannelOutput)
PutDeliveryChannel(*configservice.PutDeliveryChannelInput) (*configservice.PutDeliveryChannelOutput, error)
PutEvaluationsRequest(*configservice.PutEvaluationsInput) (*request.Request, *configservice.PutEvaluationsOutput)
PutEvaluations(*configservice.PutEvaluationsInput) (*configservice.PutEvaluationsOutput, error)
StartConfigurationRecorderRequest(*configservice.StartConfigurationRecorderInput) (*request.Request, *configservice.StartConfigurationRecorderOutput)
StartConfigurationRecorder(*configservice.StartConfigurationRecorderInput) (*configservice.StartConfigurationRecorderOutput, error)
StopConfigurationRecorderRequest(*configservice.StopConfigurationRecorderInput) (*request.Request, *configservice.StopConfigurationRecorderOutput)
StopConfigurationRecorder(*configservice.StopConfigurationRecorderInput) (*configservice.StopConfigurationRecorderOutput, error)
}
var _ ConfigServiceAPI = (*configservice.ConfigService)(nil)

Some files were not shown because too many files have changed in this diff Show More