123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package workspaces_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/workspaces"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleWorkSpaces_CreateTags() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- 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)
- }
- 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)
- }
- 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)
- }
- func ExampleWorkSpaces_DescribeTags() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- 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)
- }
- func ExampleWorkSpaces_DescribeWorkspaceBundles() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- 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)
- }
- 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)
- }
- func ExampleWorkSpaces_DescribeWorkspaces() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- 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)
- }
- func ExampleWorkSpaces_DescribeWorkspacesConnectionStatus() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- params := &workspaces.DescribeWorkspacesConnectionStatusInput{
- NextToken: aws.String("PaginationToken"),
- WorkspaceIds: []*string{
- aws.String("WorkspaceId"), // Required
- // More values...
- },
- }
- resp, err := svc.DescribeWorkspacesConnectionStatus(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 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)
- }
- func ExampleWorkSpaces_RebootWorkspaces() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- params := &workspaces.RebootWorkspacesInput{
- RebootWorkspaceRequests: []*workspaces.RebootRequest{ // Required
- { // Required
- WorkspaceId: aws.String("WorkspaceId"), // Required
- },
- // More values...
- },
- }
- resp, err := svc.RebootWorkspaces(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 ExampleWorkSpaces_RebuildWorkspaces() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- 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)
- }
- func ExampleWorkSpaces_StartWorkspaces() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- params := &workspaces.StartWorkspacesInput{
- StartWorkspaceRequests: []*workspaces.StartRequest{ // Required
- { // Required
- WorkspaceId: aws.String("WorkspaceId"),
- },
- // More values...
- },
- }
- resp, err := svc.StartWorkspaces(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 ExampleWorkSpaces_StopWorkspaces() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := workspaces.New(sess)
- params := &workspaces.StopWorkspacesInput{
- StopWorkspaceRequests: []*workspaces.StopRequest{ // Required
- { // Required
- WorkspaceId: aws.String("WorkspaceId"),
- },
- // More values...
- },
- }
- resp, err := svc.StopWorkspaces(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 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)
- }
|