func ExampleEMR_ListInstances() { svc := emr.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleEMR_TerminateJobFlows() { svc := emr.New(nil) params := &emr.TerminateJobFlowsInput{ JobFlowIDs: []*string{ // Required aws.String("XmlString"), // Required // More values... }, } resp, err := svc.TerminateJobFlows(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleEMR_DescribeStep() { svc := emr.New(nil) params := &emr.DescribeStepInput{ ClusterID: aws.String("ClusterId"), // Required StepID: aws.String("StepId"), // Required } resp, err := svc.DescribeStep(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleEMR_AddInstanceGroups() { svc := emr.New(nil) 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... }, Market: aws.String("MarketType"), Name: aws.String("XmlStringMaxLen256"), }, // More values... }, JobFlowID: aws.String("XmlStringMaxLen256"), // Required } resp, err := svc.AddInstanceGroups(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleEMR_AddJobFlowSteps() { svc := emr.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleEMR_ModifyInstanceGroups() { svc := emr.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleEMR_RunJobFlow() { svc := emr.New(nil) 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... }, 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 }, SlaveInstanceType: aws.String("InstanceType"), TerminationProtected: aws.Bool(true), }, Name: aws.String("XmlStringMaxLen256"), // Required AMIVersion: aws.String("XmlStringMaxLen256"), AdditionalInfo: aws.String("XmlString"), 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func init() { Before("@emr", func() { World["client"] = emr.New(nil) }) }
func TestInterface(t *testing.T) { assert.Implements(t, (*emriface.EMRAPI)(nil), emr.New(nil)) }