Vendor AWS APIGateway API

This commit is contained in:
Raphael Randschau 2016-03-05 23:12:19 +01:00
parent 8d31c93862
commit fdf0cfa66d
5 changed files with 5210 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/apigateway"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/aws/aws-sdk-go/service/cloudtrail"
@ -84,6 +85,7 @@ type AWSClient struct {
efsconn *efs.EFS
elbconn *elb.ELB
esconn *elasticsearch.ElasticsearchService
apigateway *apigateway.APIGateway
autoscalingconn *autoscaling.AutoScaling
s3conn *s3.S3
sqsconn *sqs.SQS
@ -105,8 +107,6 @@ type AWSClient struct {
// Client configures and returns a fully initialized AWSClient
func (c *Config) Client() (interface{}, error) {
var client AWSClient
// Get the auth and region. This can fail if keys/regions were not
// specified and we're attempting to use the environment.
var errs []error
@ -117,6 +117,7 @@ func (c *Config) Client() (interface{}, error) {
errs = append(errs, err)
}
var client AWSClient
if len(errs) == 0 {
// store AWS region in client struct, for region specific operations such as
// bucket storage in S3
@ -234,6 +235,9 @@ func (c *Config) Client() (interface{}, error) {
log.Println("[INFO] Initializing ECR Connection")
client.ecrconn = ecr.New(sess)
log.Println("[INFO] Initializing API Gateway")
client.apigateway = apigateway.New(sess)
log.Println("[INFO] Initializing ECS Connection")
client.ecsconn = ecs.New(sess)
@ -316,7 +320,6 @@ func (c *Config) ValidateCredentials(iamconn *iam.IAM) error {
_, err := iamconn.GetUser(nil)
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == "AccessDenied" || awsErr.Code() == "ValidationError" {
log.Printf("[WARN] AccessDenied Error with iam.GetUser, assuming IAM profile")
// User may be an IAM instance profile, or otherwise IAM role without the

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,298 @@
// 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)
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)
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)
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
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
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)
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)
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)
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

@ -0,0 +1,14 @@
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")
})
}
}

View File

@ -0,0 +1,90 @@
// 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/private/protocol/restjson"
"github.com/aws/aws-sdk-go/private/signer/v4"
)
// 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.PushBack(v4.Sign)
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
}