本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/emr.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleEMR_CancelSteps
func ExampleEMR_CancelSteps() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
params := &emr.CancelStepsInput{
ClusterId: aws.String("XmlStringMaxLen256"),
StepIds: []*string{
aws.String("XmlStringMaxLen256"), // Required
// More values...
},
}
resp, err := svc.CancelSteps(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例2: ExampleEMR_ListInstances
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))
}
示例3: ExampleEMR_ModifyInstanceGroups
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)
}
示例4: ExampleEMR_ListSteps
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)
}
示例5: ExampleEMR_DescribeStep
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))
}
示例6: ExampleEMR_RemoveTags
func ExampleEMR_RemoveTags() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
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)
}
示例7: ExampleEMR_DescribeJobFlows
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)
}
示例8: ExampleEMR_AddTags
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)
}
示例9: ExampleEMR_RemoveAutoScalingPolicy
func ExampleEMR_RemoveAutoScalingPolicy() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
params := &emr.RemoveAutoScalingPolicyInput{
ClusterId: aws.String("ClusterId"), // Required
InstanceGroupId: aws.String("InstanceGroupId"), // Required
}
resp, err := svc.RemoveAutoScalingPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例10: ExampleEMR_ListClusters
func ExampleEMR_ListClusters() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
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)
}
示例11: ExampleEMR_ListInstances
func ExampleEMR_ListInstances() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
params := &emr.ListInstancesInput{
ClusterId: aws.String("ClusterId"), // Required
InstanceGroupId: aws.String("InstanceGroupId"),
InstanceGroupTypes: []*string{
aws.String("InstanceGroupType"), // Required
// More values...
},
InstanceStates: []*string{
aws.String("InstanceState"), // 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)
}
示例12: ExampleEMR_ListBootstrapActions
func ExampleEMR_ListBootstrapActions() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
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)
}
示例13: ExampleEMR_DescribeStep
func ExampleEMR_DescribeStep() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
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)
}
示例14: ExampleEMR_CreateSecurityConfiguration
func ExampleEMR_CreateSecurityConfiguration() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := emr.New(sess)
params := &emr.CreateSecurityConfigurationInput{
Name: aws.String("XmlString"), // Required
SecurityConfiguration: aws.String("String"), // Required
}
resp, err := svc.CreateSecurityConfiguration(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
示例15: ExampleEMR_TerminateJobFlows
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))
}