Ejemplo n.º 1
0
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)
}
Ejemplo n.º 2
0
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)
}
Ejemplo n.º 3
0
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))
}
Ejemplo n.º 4
0
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)
}
Ejemplo n.º 5
0
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)
}
Ejemplo n.º 6
0
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)
}
Ejemplo n.º 7
0
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)
}
Ejemplo n.º 8
0
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))
}
Ejemplo n.º 9
0
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)
}
Ejemplo n.º 10
0
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)
}
Ejemplo n.º 11
0
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))
}
Ejemplo n.º 12
0
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)
}
Ejemplo n.º 13
0
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)
}
Ejemplo n.º 14
0
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)
}
Ejemplo n.º 15
0
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)
}
Ejemplo n.º 16
0
func ExampleDirectoryService_AddIpRoutes() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := directoryservice.New(sess)

	params := &directoryservice.AddIpRoutesInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		IpRoutes: []*directoryservice.IpRoute{ // Required
			{ // Required
				CidrIp:      aws.String("CidrIp"),
				Description: aws.String("Description"),
			},
			// More values...
		},
		UpdateSecurityGroupForDirectoryControllers: aws.Bool(true),
	}
	resp, err := svc.AddIpRoutes(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)
}
Ejemplo n.º 17
0
func ExampleDirectoryService_StartSchemaExtension() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := directoryservice.New(sess)

	params := &directoryservice.StartSchemaExtensionInput{
		CreateSnapshotBeforeSchemaExtension: aws.Bool(true),            // Required
		Description:                         aws.String("Description"), // Required
		DirectoryId:                         aws.String("DirectoryId"), // Required
		LdifContent:                         aws.String("LdifContent"), // Required
	}
	resp, err := svc.StartSchemaExtension(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)
}
Ejemplo n.º 18
0
func ExampleDirectoryService_ListTagsForResource() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := directoryservice.New(sess)

	params := &directoryservice.ListTagsForResourceInput{
		ResourceId: aws.String("ResourceId"), // Required
		Limit:      aws.Int64(1),
		NextToken:  aws.String("NextToken"),
	}
	resp, err := svc.ListTagsForResource(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)
}
Ejemplo n.º 19
0
func ExampleDirectoryService_GetDirectoryLimits() {
	svc := directoryservice.New(session.New())

	var params *directoryservice.GetDirectoryLimitsInput
	resp, err := svc.GetDirectoryLimits(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)
}
Ejemplo n.º 20
0
func ExampleDirectoryService_RestoreFromSnapshot() {
	svc := directoryservice.New(nil)

	params := &directoryservice.RestoreFromSnapshotInput{
		SnapshotId: aws.String("SnapshotId"), // Required
	}
	resp, err := svc.RestoreFromSnapshot(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)
}
Ejemplo n.º 21
0
func ExampleDirectoryService_VerifyTrust() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.VerifyTrustInput{
		TrustId: aws.String("TrustId"), // Required
	}
	resp, err := svc.VerifyTrust(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)
}
Ejemplo n.º 22
0
func ExampleDirectoryService_DisableRadius() {
	svc := directoryservice.New(nil)

	params := &directoryservice.DisableRadiusInput{
		DirectoryId: aws.String("DirectoryId"), // Required
	}
	resp, err := svc.DisableRadius(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)
}
Ejemplo n.º 23
0
func ExampleDirectoryService_CreateAlias() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.CreateAliasInput{
		Alias:       aws.String("AliasName"),   // Required
		DirectoryId: aws.String("DirectoryId"), // Required
	}
	resp, err := svc.CreateAlias(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)
}
Ejemplo n.º 24
0
func ExampleDirectoryService_DeleteConditionalForwarder() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.DeleteConditionalForwarderInput{
		DirectoryId:      aws.String("DirectoryId"),      // Required
		RemoteDomainName: aws.String("RemoteDomainName"), // Required
	}
	resp, err := svc.DeleteConditionalForwarder(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)
}
Ejemplo n.º 25
0
func ExampleDirectoryService_ConnectDirectory() {
	svc := directoryservice.New(nil)

	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 {
		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))
}
func ExampleDirectoryService_ListIpRoutes() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.ListIpRoutesInput{
		DirectoryId: aws.String("DirectoryId"), // Required
		Limit:       aws.Int64(1),
		NextToken:   aws.String("NextToken"),
	}
	resp, err := svc.ListIpRoutes(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)
}
Ejemplo n.º 27
0
func ExampleDirectoryService_UpdateRadius() {
	svc := directoryservice.New(nil)

	params := &directoryservice.UpdateRadiusInput{
		DirectoryID: aws.String("DirectoryId"), // Required
		RadiusSettings: &directoryservice.RadiusSettings{ // Required
			AuthenticationProtocol: aws.String("RadiusAuthenticationProtocol"),
			DisplayLabel:           aws.String("RadiusDisplayLabel"),
			RadiusPort:             aws.Long(1),
			RadiusRetries:          aws.Long(1),
			RadiusServers: []*string{
				aws.String("Server"), // Required
				// More values...
			},
			RadiusTimeout:   aws.Long(1),
			SharedSecret:    aws.String("RadiusSharedSecret"),
			UseSameUsername: aws.Boolean(true),
		},
	}
	resp, err := svc.UpdateRadius(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))
}
func ExampleDirectoryService_RemoveIpRoutes() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.RemoveIpRoutesInput{
		CidrIps: []*string{ // Required
			aws.String("CidrIp"), // Required
			// More values...
		},
		DirectoryId: aws.String("DirectoryId"), // Required
	}
	resp, err := svc.RemoveIpRoutes(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)
}
Ejemplo n.º 29
0
func ExampleDirectoryService_DescribeEventTopics() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.DescribeEventTopicsInput{
		DirectoryId: aws.String("DirectoryId"),
		TopicNames: []*string{
			aws.String("TopicName"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeEventTopics(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)
}
Ejemplo n.º 30
0
func ExampleDirectoryService_CreateTrust() {
	svc := directoryservice.New(session.New())

	params := &directoryservice.CreateTrustInput{
		DirectoryId:      aws.String("DirectoryId"),      // Required
		RemoteDomainName: aws.String("RemoteDomainName"), // Required
		TrustDirection:   aws.String("TrustDirection"),   // Required
		TrustPassword:    aws.String("TrustPassword"),    // Required
		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)
}