本文整理匯總了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)
}
示例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)
}
示例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))
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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))
}
示例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)
}
示例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)
}
示例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))
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}