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


Golang directoryservice.New函数代码示例

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


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

示例1: ExampleDirectoryService_AddTagsToResource

func ExampleDirectoryService_AddTagsToResource() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.AddTagsToResourceInput{
		ResourceId: aws.String("ResourceId"), // Required
		Tags: []*directoryservice.Tag{ // Required
			{ // Required
				Key:   aws.String("TagKey"),   // Required
				Value: aws.String("TagValue"), // Required
			},
			// More values...
		},
	}
	resp, err := svc.AddTagsToResource(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:Xercoy,项目名称:aws-sdk-go,代码行数:25,代码来源:examples_test.go

示例2: ExampleDirectoryService_RegisterEventTopic

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

	svc := directoryservice.New(sess)

	params := &directoryservice.RegisterEventTopicInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		TopicName:   aws.String("TopicName"),   // Required
	}
	resp, err := svc.RegisterEventTopic(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:realestate-com-au,项目名称:shush,代码行数:25,代码来源:examples_test.go

示例3: ExampleDirectoryService_CreateAlias

func ExampleDirectoryService_CreateAlias() {
	svc := directoryservice.New(nil)

	params := &directoryservice.CreateAliasInput{
		Alias:       aws.String("AliasName"),   // Required
		DirectoryID: aws.String("DirectoryId"), // Required
	}
	resp, err := svc.CreateAlias(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,代码行数:27,代码来源:examples_test.go

示例4: ExampleDirectoryService_EnableSso

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

	svc := directoryservice.New(sess)

	params := &directoryservice.EnableSsoInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		Password:    aws.String("ConnectPassword"),
		UserName:    aws.String("UserName"),
	}
	resp, err := svc.EnableSso(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:realestate-com-au,项目名称:shush,代码行数:26,代码来源:examples_test.go

示例5: ExampleDirectoryService_RemoveTagsFromResource

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

	svc := directoryservice.New(sess)

	params := &directoryservice.RemoveTagsFromResourceInput{
		ResourceId: aws.String("ResourceId"), // Required
		TagKeys: []*string{ // Required
			aws.String("TagKey"), // Required
			// More values...
		},
	}
	resp, err := svc.RemoveTagsFromResource(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:realestate-com-au,项目名称:shush,代码行数:28,代码来源:examples_test.go

示例6: ExampleDirectoryService_ConnectDirectory

func ExampleDirectoryService_ConnectDirectory() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.ConnectDirectoryInput{
		ConnectSettings: &directoryservice.DirectoryConnectSettings{ // Required
			CustomerDnsIps: []*string{ // Required
				aws.String("IpAddr"), // Required
				// More values...
			},
			CustomerUserName: aws.String("UserName"), // Required
			SubnetIds: []*string{ // Required
				aws.String("SubnetId"), // Required
				// More values...
			},
			VpcId: aws.String("VpcId"), // Required
		},
		Name:        aws.String("DirectoryName"),   // Required
		Password:    aws.String("ConnectPassword"), // Required
		Size:        aws.String("DirectorySize"),   // Required
		Description: aws.String("Description"),
		ShortName:   aws.String("DirectoryShortName"),
	}
	resp, err := svc.ConnectDirectory(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:CNDonny,项目名称:scope,代码行数:34,代码来源:examples_test.go

示例7: ExampleDirectoryService_CreateComputer

func ExampleDirectoryService_CreateComputer() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.CreateComputerInput{
		ComputerName: aws.String("ComputerName"),     // Required
		DirectoryId:  aws.String("DirectoryId"),      // Required
		Password:     aws.String("ComputerPassword"), // Required
		ComputerAttributes: []*directoryservice.Attribute{
			{ // Required
				Name:  aws.String("AttributeName"),
				Value: aws.String("AttributeValue"),
			},
			// More values...
		},
		OrganizationalUnitDistinguishedName: aws.String("OrganizationalUnitDN"),
	}
	resp, err := svc.CreateComputer(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:CNDonny,项目名称:scope,代码行数:28,代码来源:examples_test.go

示例8: ExampleDirectoryService_EnableSso

func ExampleDirectoryService_EnableSso() {
	svc := directoryservice.New(nil)

	params := &directoryservice.EnableSsoInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		Password:    aws.String("ConnectPassword"),
		UserName:    aws.String("UserName"),
	}
	resp, err := svc.EnableSso(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,代码行数:28,代码来源:examples_test.go

示例9: ExampleDirectoryService_CreateMicrosoftAD

func ExampleDirectoryService_CreateMicrosoftAD() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.CreateMicrosoftADInput{
		Name:     aws.String("DirectoryName"), // Required
		Password: aws.String("Password"),      // Required
		VpcSettings: &directoryservice.DirectoryVpcSettings{ // Required
			SubnetIds: []*string{ // Required
				aws.String("SubnetId"), // Required
				// More values...
			},
			VpcId: aws.String("VpcId"), // Required
		},
		Description: aws.String("Description"),
		ShortName:   aws.String("DirectoryShortName"),
	}
	resp, err := svc.CreateMicrosoftAD(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:CNDonny,项目名称:scope,代码行数:28,代码来源:examples_test.go

示例10: ExampleDirectoryService_DescribeTrusts

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

	svc := directoryservice.New(sess)

	params := &directoryservice.DescribeTrustsInput{
		DirectoryId: aws.String("DirectoryId"),
		Limit:       aws.Int64(1),
		NextToken:   aws.String("NextToken"),
		TrustIds: []*string{
			aws.String("TrustId"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeTrusts(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:realestate-com-au,项目名称:shush,代码行数:30,代码来源:examples_test.go

示例11: ExampleDirectoryService_DescribeSnapshots

func ExampleDirectoryService_DescribeSnapshots() {
	svc := directoryservice.New(nil)

	params := &directoryservice.DescribeSnapshotsInput{
		DirectoryID: aws.String("DirectoryId"),
		Limit:       aws.Long(1),
		NextToken:   aws.String("NextToken"),
		SnapshotIDs: []*string{
			aws.String("SnapshotId"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeSnapshots(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,代码行数:32,代码来源:examples_test.go

示例12: ExampleDirectoryService_UpdateRadius

func ExampleDirectoryService_UpdateRadius() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.UpdateRadiusInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		RadiusSettings: &directoryservice.RadiusSettings{ // Required
			AuthenticationProtocol: aws.String("RadiusAuthenticationProtocol"),
			DisplayLabel:           aws.String("RadiusDisplayLabel"),
			RadiusPort:             aws.Int64(1),
			RadiusRetries:          aws.Int64(1),
			RadiusServers: []*string{
				aws.String("Server"), // Required
				// More values...
			},
			RadiusTimeout:   aws.Int64(1),
			SharedSecret:    aws.String("RadiusSharedSecret"),
			UseSameUsername: aws.Bool(true),
		},
	}
	resp, err := svc.UpdateRadius(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:CNDonny,项目名称:scope,代码行数:31,代码来源:examples_test.go

示例13: ExampleDirectoryService_DeleteTrust

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

	svc := directoryservice.New(sess)

	params := &directoryservice.DeleteTrustInput{
		TrustId: aws.String("TrustId"), // Required
		DeleteAssociatedConditionalForwarder: aws.Bool(true),
	}
	resp, err := svc.DeleteTrust(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:realestate-com-au,项目名称:shush,代码行数:25,代码来源:examples_test.go

示例14: ExampleDirectoryService_DescribeConditionalForwarders

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

	svc := directoryservice.New(sess)

	params := &directoryservice.DescribeConditionalForwardersInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		RemoteDomainNames: []*string{
			aws.String("RemoteDomainName"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeConditionalForwarders(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:realestate-com-au,项目名称:shush,代码行数:28,代码来源:examples_test.go

示例15: ExampleDirectoryService_CreateTrust

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

	svc := directoryservice.New(sess)

	params := &directoryservice.CreateTrustInput{
		DirectoryId:      aws.String("DirectoryId"),      // Required
		RemoteDomainName: aws.String("RemoteDomainName"), // Required
		TrustDirection:   aws.String("TrustDirection"),   // Required
		TrustPassword:    aws.String("TrustPassword"),    // Required
		ConditionalForwarderIpAddrs: []*string{
			aws.String("IpAddr"), // Required
			// More values...
		},
		TrustType: aws.String("TrustType"),
	}
	resp, err := svc.CreateTrust(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:realestate-com-au,项目名称:shush,代码行数:32,代码来源:examples_test.go


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