当前位置: 首页>>代码示例>>Golang>>正文


Golang workspaces.New函数代码示例

本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/workspaces.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ExampleWorkSpaces_DescribeWorkspaceDirectories

func ExampleWorkSpaces_DescribeWorkspaceDirectories() {
	svc := workspaces.New(nil)

	params := &workspaces.DescribeWorkspaceDirectoriesInput{
		DirectoryIDs: []*string{
			aws.String("DirectoryId"), // Required
			// More values...
		},
		NextToken: aws.String("PaginationToken"),
	}
	resp, err := svc.DescribeWorkspaceDirectories(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.StringValue(resp))
}
开发者ID:reyco,项目名称:aws-sdk-go,代码行数:30,代码来源:examples_test.go

示例2: ExampleWorkSpaces_TerminateWorkspaces

func ExampleWorkSpaces_TerminateWorkspaces() {
	svc := workspaces.New(nil)

	params := &workspaces.TerminateWorkspacesInput{
		TerminateWorkspaceRequests: []*workspaces.TerminateRequest{ // Required
			{ // Required
				WorkspaceId: aws.String("WorkspaceId"), // Required
			},
			// More values...
		},
	}
	resp, err := svc.TerminateWorkspaces(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))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:31,代码来源:examples_test.go

示例3: ExampleWorkSpaces_DescribeWorkspaces

func ExampleWorkSpaces_DescribeWorkspaces() {
	svc := workspaces.New(nil)

	params := &workspaces.DescribeWorkspacesInput{
		BundleId:    aws.String("BundleId"),
		DirectoryId: aws.String("DirectoryId"),
		Limit:       aws.Int64(1),
		NextToken:   aws.String("PaginationToken"),
		UserName:    aws.String("UserName"),
		WorkspaceIds: []*string{
			aws.String("WorkspaceId"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeWorkspaces(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:skion,项目名称:amazon-ecs-cli,代码行数:26,代码来源:examples_test.go

示例4: ExampleWorkSpaces_TerminateWorkspaces

func ExampleWorkSpaces_TerminateWorkspaces() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := workspaces.New(sess)

	params := &workspaces.TerminateWorkspacesInput{
		TerminateWorkspaceRequests: []*workspaces.TerminateRequest{ // Required
			{ // Required
				WorkspaceId: aws.String("WorkspaceId"), // Required
			},
			// More values...
		},
	}
	resp, err := svc.TerminateWorkspaces(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:29,代码来源:examples_test.go

示例5: ExampleWorkSpaces_CreateWorkspaces

func ExampleWorkSpaces_CreateWorkspaces() {
	svc := workspaces.New(nil)

	params := &workspaces.CreateWorkspacesInput{
		Workspaces: []*workspaces.WorkspaceRequest{ // Required
			{ // Required
				BundleId:                    aws.String("BundleId"),    // Required
				DirectoryId:                 aws.String("DirectoryId"), // Required
				UserName:                    aws.String("UserName"),    // Required
				RootVolumeEncryptionEnabled: aws.Bool(true),
				UserVolumeEncryptionEnabled: aws.Bool(true),
				VolumeEncryptionKey:         aws.String("VolumeEncryptionKey"),
			},
			// More values...
		},
	}
	resp, err := svc.CreateWorkspaces(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:skion,项目名称:amazon-ecs-cli,代码行数:28,代码来源:examples_test.go

示例6: ExampleWorkSpaces_DeleteTags

func ExampleWorkSpaces_DeleteTags() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := workspaces.New(sess)

	params := &workspaces.DeleteTagsInput{
		ResourceId: aws.String("NonEmptyString"), // Required
		TagKeys: []*string{ // Required
			aws.String("NonEmptyString"), // 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)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:28,代码来源:examples_test.go

示例7: ExampleWorkSpaces_CreateTags

func ExampleWorkSpaces_CreateTags() {
	svc := workspaces.New(session.New())

	params := &workspaces.CreateTagsInput{
		ResourceId: aws.String("NonEmptyString"), // Required
		Tags: []*workspaces.Tag{ // Required
			{ // Required
				Key:   aws.String("TagKey"), // Required
				Value: aws.String("TagValue"),
			},
			// 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)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:25,代码来源:examples_test.go

示例8: ExampleWorkSpaces_DescribeWorkspaceDirectories

func ExampleWorkSpaces_DescribeWorkspaceDirectories() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := workspaces.New(sess)

	params := &workspaces.DescribeWorkspaceDirectoriesInput{
		DirectoryIds: []*string{
			aws.String("DirectoryId"), // Required
			// More values...
		},
		NextToken: aws.String("PaginationToken"),
	}
	resp, err := svc.DescribeWorkspaceDirectories(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:roman-vynar,项目名称:grafana,代码行数:28,代码来源:examples_test.go

示例9: ExampleWorkSpaces_ModifyWorkspaceProperties

func ExampleWorkSpaces_ModifyWorkspaceProperties() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := workspaces.New(sess)

	params := &workspaces.ModifyWorkspacePropertiesInput{
		WorkspaceId: aws.String("WorkspaceId"), // Required
		WorkspaceProperties: &workspaces.WorkspaceProperties{ // Required
			RunningMode:                         aws.String("RunningMode"),
			RunningModeAutoStopTimeoutInMinutes: aws.Int64(1),
		},
	}
	resp, err := svc.ModifyWorkspaceProperties(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:28,代码来源:examples_test.go

示例10: ExampleWorkSpaces_CreateWorkspaces

func ExampleWorkSpaces_CreateWorkspaces() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := workspaces.New(sess)

	params := &workspaces.CreateWorkspacesInput{
		Workspaces: []*workspaces.WorkspaceRequest{ // Required
			{ // Required
				BundleId:                    aws.String("BundleId"),    // Required
				DirectoryId:                 aws.String("DirectoryId"), // Required
				UserName:                    aws.String("UserName"),    // Required
				RootVolumeEncryptionEnabled: aws.Bool(true),
				Tags: []*workspaces.Tag{
					{ // Required
						Key:   aws.String("TagKey"), // Required
						Value: aws.String("TagValue"),
					},
					// More values...
				},
				UserVolumeEncryptionEnabled: aws.Bool(true),
				VolumeEncryptionKey:         aws.String("VolumeEncryptionKey"),
				WorkspaceProperties: &workspaces.WorkspaceProperties{
					RunningMode:                         aws.String("RunningMode"),
					RunningModeAutoStopTimeoutInMinutes: aws.Int64(1),
				},
			},
			// More values...
		},
	}
	resp, err := svc.CreateWorkspaces(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:45,代码来源:examples_test.go

示例11: ExampleWorkSpaces_DescribeTags

func ExampleWorkSpaces_DescribeTags() {
	svc := workspaces.New(session.New())

	params := &workspaces.DescribeTagsInput{
		ResourceId: aws.String("NonEmptyString"), // Required
	}
	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)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:18,代码来源:examples_test.go

示例12: ExampleWorkSpaces_RebuildWorkspaces

func ExampleWorkSpaces_RebuildWorkspaces() {
	svc := workspaces.New(nil)

	params := &workspaces.RebuildWorkspacesInput{
		RebuildWorkspaceRequests: []*workspaces.RebuildRequest{ // Required
			{ // Required
				WorkspaceId: aws.String("WorkspaceId"), // Required
			},
			// More values...
		},
	}
	resp, err := svc.RebuildWorkspaces(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:skion,项目名称:amazon-ecs-cli,代码行数:23,代码来源:examples_test.go

示例13: ExampleWorkSpaces_DescribeWorkspaceBundles

func ExampleWorkSpaces_DescribeWorkspaceBundles() {
	svc := workspaces.New(session.New())

	params := &workspaces.DescribeWorkspaceBundlesInput{
		BundleIds: []*string{
			aws.String("BundleId"), // Required
			// More values...
		},
		NextToken: aws.String("PaginationToken"),
		Owner:     aws.String("BundleOwner"),
	}
	resp, err := svc.DescribeWorkspaceBundles(params)

	if err != nil {
		// Print the error, cast err to awserr.Error to get the Code and
		// Message from an error.
		fmt.Println(err.Error())
		return
	}

	// Pretty-print the response data.
	fmt.Println(resp)
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:23,代码来源:examples_test.go

示例14: init

func init() {
	Before("@workspaces", func() {
		World["client"] = workspaces.New(nil)
	})
}
开发者ID:rifflock,项目名称:aws-sdk-go,代码行数:5,代码来源:client.go

示例15: init

func init() {
	gucumber.Before("@workspaces", func() {
		gucumber.World["client"] = workspaces.New(smoke.Session)
	})
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:5,代码来源:client.go


注:本文中的github.com/aws/aws-sdk-go/service/workspaces.New函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。