provider/aws: Add AWS EMR dependency (#2098) (#6492)

This commit is contained in:
Blake Smith 2016-05-05 05:34:18 -05:00 committed by Paul Stack
parent 4f2eec0c3a
commit 8821aea945
7 changed files with 4023 additions and 0 deletions

5
Godeps/Godeps.json generated
View File

@ -450,6 +450,11 @@
"Comment": "v1.1.15", "Comment": "v1.1.15",
"Rev": "e7cf1e5986499eea7d4a87868f1eb578c8f2045a" "Rev": "e7cf1e5986499eea7d4a87868f1eb578c8f2045a"
}, },
{
"ImportPath": "github.com/aws/aws-sdk-go/service/emr",
"Comment": "v1.1.15",
"Rev": "e7cf1e5986499eea7d4a87868f1eb578c8f2045a"
},
{ {
"ImportPath": "github.com/aws/aws-sdk-go/service/firehose", "ImportPath": "github.com/aws/aws-sdk-go/service/firehose",
"Comment": "v1.1.15", "Comment": "v1.1.15",

View File

@ -37,6 +37,7 @@ import (
"github.com/aws/aws-sdk-go/service/elasticbeanstalk" "github.com/aws/aws-sdk-go/service/elasticbeanstalk"
elasticsearch "github.com/aws/aws-sdk-go/service/elasticsearchservice" elasticsearch "github.com/aws/aws-sdk-go/service/elasticsearchservice"
"github.com/aws/aws-sdk-go/service/elb" "github.com/aws/aws-sdk-go/service/elb"
"github.com/aws/aws-sdk-go/service/emr"
"github.com/aws/aws-sdk-go/service/firehose" "github.com/aws/aws-sdk-go/service/firehose"
"github.com/aws/aws-sdk-go/service/glacier" "github.com/aws/aws-sdk-go/service/glacier"
"github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/iam"
@ -86,6 +87,7 @@ type AWSClient struct {
ecsconn *ecs.ECS ecsconn *ecs.ECS
efsconn *efs.EFS efsconn *efs.EFS
elbconn *elb.ELB elbconn *elb.ELB
emrconn *emr.EMR
esconn *elasticsearch.ElasticsearchService esconn *elasticsearch.ElasticsearchService
apigateway *apigateway.APIGateway apigateway *apigateway.APIGateway
autoscalingconn *autoscaling.AutoScaling autoscalingconn *autoscaling.AutoScaling
@ -246,6 +248,9 @@ func (c *Config) Client() (interface{}, error) {
log.Println("[INFO] Initializing ElasticSearch Connection") log.Println("[INFO] Initializing ElasticSearch Connection")
client.esconn = elasticsearch.New(sess) client.esconn = elasticsearch.New(sess)
log.Println("[INFO] Initializing EMR Connection")
client.emrconn = emr.New(sess)
log.Println("[INFO] Initializing Route 53 connection") log.Println("[INFO] Initializing Route 53 connection")
client.r53conn = route53.New(usEast1Sess) client.r53conn = route53.New(usEast1Sess)

3123
vendor/github.com/aws/aws-sdk-go/service/emr/api.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,92 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package emriface provides an interface for the Amazon Elastic MapReduce.
package emriface
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/emr"
)
// EMRAPI is the interface type for emr.EMR.
type EMRAPI interface {
AddInstanceGroupsRequest(*emr.AddInstanceGroupsInput) (*request.Request, *emr.AddInstanceGroupsOutput)
AddInstanceGroups(*emr.AddInstanceGroupsInput) (*emr.AddInstanceGroupsOutput, error)
AddJobFlowStepsRequest(*emr.AddJobFlowStepsInput) (*request.Request, *emr.AddJobFlowStepsOutput)
AddJobFlowSteps(*emr.AddJobFlowStepsInput) (*emr.AddJobFlowStepsOutput, error)
AddTagsRequest(*emr.AddTagsInput) (*request.Request, *emr.AddTagsOutput)
AddTags(*emr.AddTagsInput) (*emr.AddTagsOutput, error)
DescribeClusterRequest(*emr.DescribeClusterInput) (*request.Request, *emr.DescribeClusterOutput)
DescribeCluster(*emr.DescribeClusterInput) (*emr.DescribeClusterOutput, error)
DescribeJobFlowsRequest(*emr.DescribeJobFlowsInput) (*request.Request, *emr.DescribeJobFlowsOutput)
DescribeJobFlows(*emr.DescribeJobFlowsInput) (*emr.DescribeJobFlowsOutput, error)
DescribeStepRequest(*emr.DescribeStepInput) (*request.Request, *emr.DescribeStepOutput)
DescribeStep(*emr.DescribeStepInput) (*emr.DescribeStepOutput, error)
ListBootstrapActionsRequest(*emr.ListBootstrapActionsInput) (*request.Request, *emr.ListBootstrapActionsOutput)
ListBootstrapActions(*emr.ListBootstrapActionsInput) (*emr.ListBootstrapActionsOutput, error)
ListBootstrapActionsPages(*emr.ListBootstrapActionsInput, func(*emr.ListBootstrapActionsOutput, bool) bool) error
ListClustersRequest(*emr.ListClustersInput) (*request.Request, *emr.ListClustersOutput)
ListClusters(*emr.ListClustersInput) (*emr.ListClustersOutput, error)
ListClustersPages(*emr.ListClustersInput, func(*emr.ListClustersOutput, bool) bool) error
ListInstanceGroupsRequest(*emr.ListInstanceGroupsInput) (*request.Request, *emr.ListInstanceGroupsOutput)
ListInstanceGroups(*emr.ListInstanceGroupsInput) (*emr.ListInstanceGroupsOutput, error)
ListInstanceGroupsPages(*emr.ListInstanceGroupsInput, func(*emr.ListInstanceGroupsOutput, bool) bool) error
ListInstancesRequest(*emr.ListInstancesInput) (*request.Request, *emr.ListInstancesOutput)
ListInstances(*emr.ListInstancesInput) (*emr.ListInstancesOutput, error)
ListInstancesPages(*emr.ListInstancesInput, func(*emr.ListInstancesOutput, bool) bool) error
ListStepsRequest(*emr.ListStepsInput) (*request.Request, *emr.ListStepsOutput)
ListSteps(*emr.ListStepsInput) (*emr.ListStepsOutput, error)
ListStepsPages(*emr.ListStepsInput, func(*emr.ListStepsOutput, bool) bool) error
ModifyInstanceGroupsRequest(*emr.ModifyInstanceGroupsInput) (*request.Request, *emr.ModifyInstanceGroupsOutput)
ModifyInstanceGroups(*emr.ModifyInstanceGroupsInput) (*emr.ModifyInstanceGroupsOutput, error)
RemoveTagsRequest(*emr.RemoveTagsInput) (*request.Request, *emr.RemoveTagsOutput)
RemoveTags(*emr.RemoveTagsInput) (*emr.RemoveTagsOutput, error)
RunJobFlowRequest(*emr.RunJobFlowInput) (*request.Request, *emr.RunJobFlowOutput)
RunJobFlow(*emr.RunJobFlowInput) (*emr.RunJobFlowOutput, error)
SetTerminationProtectionRequest(*emr.SetTerminationProtectionInput) (*request.Request, *emr.SetTerminationProtectionOutput)
SetTerminationProtection(*emr.SetTerminationProtectionInput) (*emr.SetTerminationProtectionOutput, error)
SetVisibleToAllUsersRequest(*emr.SetVisibleToAllUsersInput) (*request.Request, *emr.SetVisibleToAllUsersOutput)
SetVisibleToAllUsers(*emr.SetVisibleToAllUsersInput) (*emr.SetVisibleToAllUsersOutput, error)
TerminateJobFlowsRequest(*emr.TerminateJobFlowsInput) (*request.Request, *emr.TerminateJobFlowsOutput)
TerminateJobFlows(*emr.TerminateJobFlowsInput) (*emr.TerminateJobFlowsOutput, error)
}
var _ EMRAPI = (*emr.EMR)(nil)

View File

@ -0,0 +1,617 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package emr_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/emr"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleEMR_AddInstanceGroups() {
svc := emr.New(session.New())
params := &emr.AddInstanceGroupsInput{
InstanceGroups: []*emr.InstanceGroupConfig{ // Required
{ // Required
InstanceCount: aws.Int64(1), // Required
InstanceRole: aws.String("InstanceRoleType"), // Required
InstanceType: aws.String("InstanceType"), // Required
BidPrice: aws.String("XmlStringMaxLen256"),
Configurations: []*emr.Configuration{
{ // Required
Classification: aws.String("String"),
Configurations: []*emr.Configuration{
// Recursive values...
},
Properties: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
},
// More values...
},
EbsConfiguration: &emr.EbsConfiguration{
EbsBlockDeviceConfigs: []*emr.EbsBlockDeviceConfig{
{ // Required
VolumeSpecification: &emr.VolumeSpecification{ // Required
SizeInGB: aws.Int64(1), // Required
VolumeType: aws.String("String"), // Required
Iops: aws.Int64(1),
},
VolumesPerInstance: aws.Int64(1),
},
// More values...
},
EbsOptimized: aws.Bool(true),
},
Market: aws.String("MarketType"),
Name: aws.String("XmlStringMaxLen256"),
},
// More values...
},
JobFlowId: aws.String("XmlStringMaxLen256"), // Required
}
resp, err := svc.AddInstanceGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_AddJobFlowSteps() {
svc := emr.New(session.New())
params := &emr.AddJobFlowStepsInput{
JobFlowId: aws.String("XmlStringMaxLen256"), // Required
Steps: []*emr.StepConfig{ // Required
{ // Required
HadoopJarStep: &emr.HadoopJarStepConfig{ // Required
Jar: aws.String("XmlString"), // Required
Args: []*string{
aws.String("XmlString"), // Required
// More values...
},
MainClass: aws.String("XmlString"),
Properties: []*emr.KeyValue{
{ // Required
Key: aws.String("XmlString"),
Value: aws.String("XmlString"),
},
// More values...
},
},
Name: aws.String("XmlStringMaxLen256"), // Required
ActionOnFailure: aws.String("ActionOnFailure"),
},
// More values...
},
}
resp, err := svc.AddJobFlowSteps(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_AddTags() {
svc := emr.New(session.New())
params := &emr.AddTagsInput{
ResourceId: aws.String("ResourceId"), // Required
Tags: []*emr.Tag{ // Required
{ // Required
Key: aws.String("String"),
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 ExampleEMR_DescribeCluster() {
svc := emr.New(session.New())
params := &emr.DescribeClusterInput{
ClusterId: aws.String("ClusterId"), // Required
}
resp, err := svc.DescribeCluster(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_DescribeJobFlows() {
svc := emr.New(session.New())
params := &emr.DescribeJobFlowsInput{
CreatedAfter: aws.Time(time.Now()),
CreatedBefore: aws.Time(time.Now()),
JobFlowIds: []*string{
aws.String("XmlString"), // Required
// More values...
},
JobFlowStates: []*string{
aws.String("JobFlowExecutionState"), // Required
// More values...
},
}
resp, err := svc.DescribeJobFlows(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_DescribeStep() {
svc := emr.New(session.New())
params := &emr.DescribeStepInput{
ClusterId: aws.String("ClusterId"), // Required
StepId: aws.String("StepId"), // Required
}
resp, err := svc.DescribeStep(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_ListBootstrapActions() {
svc := emr.New(session.New())
params := &emr.ListBootstrapActionsInput{
ClusterId: aws.String("ClusterId"), // Required
Marker: aws.String("Marker"),
}
resp, err := svc.ListBootstrapActions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_ListClusters() {
svc := emr.New(session.New())
params := &emr.ListClustersInput{
ClusterStates: []*string{
aws.String("ClusterState"), // Required
// More values...
},
CreatedAfter: aws.Time(time.Now()),
CreatedBefore: aws.Time(time.Now()),
Marker: aws.String("Marker"),
}
resp, err := svc.ListClusters(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_ListInstanceGroups() {
svc := emr.New(session.New())
params := &emr.ListInstanceGroupsInput{
ClusterId: aws.String("ClusterId"), // Required
Marker: aws.String("Marker"),
}
resp, err := svc.ListInstanceGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_ListInstances() {
svc := emr.New(session.New())
params := &emr.ListInstancesInput{
ClusterId: aws.String("ClusterId"), // Required
InstanceGroupId: aws.String("InstanceGroupId"),
InstanceGroupTypes: []*string{
aws.String("InstanceGroupType"), // Required
// More values...
},
Marker: aws.String("Marker"),
}
resp, err := svc.ListInstances(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_ListSteps() {
svc := emr.New(session.New())
params := &emr.ListStepsInput{
ClusterId: aws.String("ClusterId"), // Required
Marker: aws.String("Marker"),
StepIds: []*string{
aws.String("XmlString"), // Required
// More values...
},
StepStates: []*string{
aws.String("StepState"), // Required
// More values...
},
}
resp, err := svc.ListSteps(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_ModifyInstanceGroups() {
svc := emr.New(session.New())
params := &emr.ModifyInstanceGroupsInput{
InstanceGroups: []*emr.InstanceGroupModifyConfig{
{ // Required
InstanceGroupId: aws.String("XmlStringMaxLen256"), // Required
EC2InstanceIdsToTerminate: []*string{
aws.String("InstanceId"), // Required
// More values...
},
InstanceCount: aws.Int64(1),
},
// More values...
},
}
resp, err := svc.ModifyInstanceGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_RemoveTags() {
svc := emr.New(session.New())
params := &emr.RemoveTagsInput{
ResourceId: aws.String("ResourceId"), // Required
TagKeys: []*string{ // Required
aws.String("String"), // Required
// 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 ExampleEMR_RunJobFlow() {
svc := emr.New(session.New())
params := &emr.RunJobFlowInput{
Instances: &emr.JobFlowInstancesConfig{ // Required
AdditionalMasterSecurityGroups: []*string{
aws.String("XmlStringMaxLen256"), // Required
// More values...
},
AdditionalSlaveSecurityGroups: []*string{
aws.String("XmlStringMaxLen256"), // Required
// More values...
},
Ec2KeyName: aws.String("XmlStringMaxLen256"),
Ec2SubnetId: aws.String("XmlStringMaxLen256"),
EmrManagedMasterSecurityGroup: aws.String("XmlStringMaxLen256"),
EmrManagedSlaveSecurityGroup: aws.String("XmlStringMaxLen256"),
HadoopVersion: aws.String("XmlStringMaxLen256"),
InstanceCount: aws.Int64(1),
InstanceGroups: []*emr.InstanceGroupConfig{
{ // Required
InstanceCount: aws.Int64(1), // Required
InstanceRole: aws.String("InstanceRoleType"), // Required
InstanceType: aws.String("InstanceType"), // Required
BidPrice: aws.String("XmlStringMaxLen256"),
Configurations: []*emr.Configuration{
{ // Required
Classification: aws.String("String"),
Configurations: []*emr.Configuration{
// Recursive values...
},
Properties: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
},
// More values...
},
EbsConfiguration: &emr.EbsConfiguration{
EbsBlockDeviceConfigs: []*emr.EbsBlockDeviceConfig{
{ // Required
VolumeSpecification: &emr.VolumeSpecification{ // Required
SizeInGB: aws.Int64(1), // Required
VolumeType: aws.String("String"), // Required
Iops: aws.Int64(1),
},
VolumesPerInstance: aws.Int64(1),
},
// More values...
},
EbsOptimized: aws.Bool(true),
},
Market: aws.String("MarketType"),
Name: aws.String("XmlStringMaxLen256"),
},
// More values...
},
KeepJobFlowAliveWhenNoSteps: aws.Bool(true),
MasterInstanceType: aws.String("InstanceType"),
Placement: &emr.PlacementType{
AvailabilityZone: aws.String("XmlString"), // Required
},
ServiceAccessSecurityGroup: aws.String("XmlStringMaxLen256"),
SlaveInstanceType: aws.String("InstanceType"),
TerminationProtected: aws.Bool(true),
},
Name: aws.String("XmlStringMaxLen256"), // Required
AdditionalInfo: aws.String("XmlString"),
AmiVersion: aws.String("XmlStringMaxLen256"),
Applications: []*emr.Application{
{ // Required
AdditionalInfo: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
Args: []*string{
aws.String("String"), // Required
// More values...
},
Name: aws.String("String"),
Version: aws.String("String"),
},
// More values...
},
BootstrapActions: []*emr.BootstrapActionConfig{
{ // Required
Name: aws.String("XmlStringMaxLen256"), // Required
ScriptBootstrapAction: &emr.ScriptBootstrapActionConfig{ // Required
Path: aws.String("XmlString"), // Required
Args: []*string{
aws.String("XmlString"), // Required
// More values...
},
},
},
// More values...
},
Configurations: []*emr.Configuration{
{ // Required
Classification: aws.String("String"),
Configurations: []*emr.Configuration{
// Recursive values...
},
Properties: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
},
// More values...
},
JobFlowRole: aws.String("XmlString"),
LogUri: aws.String("XmlString"),
NewSupportedProducts: []*emr.SupportedProductConfig{
{ // Required
Args: []*string{
aws.String("XmlString"), // Required
// More values...
},
Name: aws.String("XmlStringMaxLen256"),
},
// More values...
},
ReleaseLabel: aws.String("XmlStringMaxLen256"),
ServiceRole: aws.String("XmlString"),
Steps: []*emr.StepConfig{
{ // Required
HadoopJarStep: &emr.HadoopJarStepConfig{ // Required
Jar: aws.String("XmlString"), // Required
Args: []*string{
aws.String("XmlString"), // Required
// More values...
},
MainClass: aws.String("XmlString"),
Properties: []*emr.KeyValue{
{ // Required
Key: aws.String("XmlString"),
Value: aws.String("XmlString"),
},
// More values...
},
},
Name: aws.String("XmlStringMaxLen256"), // Required
ActionOnFailure: aws.String("ActionOnFailure"),
},
// More values...
},
SupportedProducts: []*string{
aws.String("XmlStringMaxLen256"), // Required
// More values...
},
Tags: []*emr.Tag{
{ // Required
Key: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
VisibleToAllUsers: aws.Bool(true),
}
resp, err := svc.RunJobFlow(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_SetTerminationProtection() {
svc := emr.New(session.New())
params := &emr.SetTerminationProtectionInput{
JobFlowIds: []*string{ // Required
aws.String("XmlString"), // Required
// More values...
},
TerminationProtected: aws.Bool(true), // Required
}
resp, err := svc.SetTerminationProtection(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_SetVisibleToAllUsers() {
svc := emr.New(session.New())
params := &emr.SetVisibleToAllUsersInput{
JobFlowIds: []*string{ // Required
aws.String("XmlString"), // Required
// More values...
},
VisibleToAllUsers: aws.Bool(true), // Required
}
resp, err := svc.SetVisibleToAllUsers(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleEMR_TerminateJobFlows() {
svc := emr.New(session.New())
params := &emr.TerminateJobFlowsInput{
JobFlowIds: []*string{ // Required
aws.String("XmlString"), // Required
// More values...
},
}
resp, err := svc.TerminateJobFlows(params)
if err != nil {
// Print the error, cast err to 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

@ -0,0 +1,92 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package emr
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/jsonrpc"
"github.com/aws/aws-sdk-go/private/signer/v4"
)
// Amazon Elastic MapReduce (Amazon EMR) is a web service that makes it easy
// to process large amounts of data efficiently. Amazon EMR uses Hadoop processing
// combined with several AWS products to do tasks such as web indexing, data
// mining, log file analysis, machine learning, scientific simulation, and data
// warehousing.
//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 EMR 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 = "elasticmapreduce"
// New creates a new instance of the EMR 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 EMR client from just a session.
// svc := emr.New(mySession)
//
// // Create a EMR client with additional configuration
// svc := emr.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EMR {
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) *EMR {
svc := &EMR{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2009-03-31",
JSONVersion: "1.1",
TargetPrefix: "ElasticMapReduce",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBack(v4.Sign)
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 EMR operation and runs any
// custom request initialization.
func (c *EMR) 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

@ -0,0 +1,89 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package emr
import (
"github.com/aws/aws-sdk-go/private/waiter"
)
func (c *EMR) WaitUntilClusterRunning(input *DescribeClusterInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeCluster",
Delay: 30,
MaxAttempts: 60,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "Cluster.Status.State",
Expected: "RUNNING",
},
{
State: "success",
Matcher: "path",
Argument: "Cluster.Status.State",
Expected: "WAITING",
},
{
State: "failure",
Matcher: "path",
Argument: "Cluster.Status.State",
Expected: "TERMINATING",
},
{
State: "failure",
Matcher: "path",
Argument: "Cluster.Status.State",
Expected: "TERMINATED",
},
{
State: "failure",
Matcher: "path",
Argument: "Cluster.Status.State",
Expected: "TERMINATED_WITH_ERRORS",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}
func (c *EMR) WaitUntilStepComplete(input *DescribeStepInput) error {
waiterCfg := waiter.Config{
Operation: "DescribeStep",
Delay: 30,
MaxAttempts: 60,
Acceptors: []waiter.WaitAcceptor{
{
State: "success",
Matcher: "path",
Argument: "Step.Status.State",
Expected: "COMPLETED",
},
{
State: "failure",
Matcher: "path",
Argument: "Step.Status.State",
Expected: "FAILED",
},
{
State: "failure",
Matcher: "path",
Argument: "Step.Status.State",
Expected: "CANCELLED",
},
},
}
w := waiter.Waiter{
Client: c,
Input: input,
Config: waiterCfg,
}
return w.Wait()
}