Example #1
0
func ExampleIoT_DeprecateThingType() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.DeprecateThingTypeInput{
		ThingTypeName: aws.String("ThingTypeName"), // Required
		UndoDeprecate: aws.Bool(true),
	}
	resp, err := svc.DeprecateThingType(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)
}
Example #2
0
func ExampleIoT_DetachThingPrincipal() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.DetachThingPrincipalInput{
		Principal: aws.String("Principal"), // Required
		ThingName: aws.String("ThingName"), // Required
	}
	resp, err := svc.DetachThingPrincipal(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)
}
Example #3
0
func ExampleIoT_AcceptCertificateTransfer() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.AcceptCertificateTransferInput{
		CertificateId: aws.String("CertificateId"), // Required
		SetAsActive:   aws.Bool(true),
	}
	resp, err := svc.AcceptCertificateTransfer(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 ExampleIoT_CreateThing() {
	svc := iot.New(session.New())

	params := &iot.CreateThingInput{
		ThingName: aws.String("ThingName"), // Required
		AttributePayload: &iot.AttributePayload{
			Attributes: map[string]*string{
				"Key": aws.String("AttributeValue"), // Required
				// More values...
			},
			Merge: aws.Bool(true),
		},
		ThingTypeName: aws.String("ThingTypeName"),
	}
	resp, err := svc.CreateThing(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)
}
Example #5
0
func ExampleIoT_ListThings() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.ListThingsInput{
		AttributeName:  aws.String("AttributeName"),
		AttributeValue: aws.String("AttributeValue"),
		MaxResults:     aws.Int64(1),
		NextToken:      aws.String("NextToken"),
		ThingTypeName:  aws.String("ThingTypeName"),
	}
	resp, err := svc.ListThings(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)
}
Example #6
0
func ExampleIoT_ListCertificates() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.ListCertificatesInput{
		AscendingOrder: aws.Bool(true),
		Marker:         aws.String("Marker"),
		PageSize:       aws.Int64(1),
	}
	resp, err := svc.ListCertificates(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)
}
Example #7
0
func ExampleIoT_UpdateThing() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.UpdateThingInput{
		ThingName: aws.String("ThingName"), // Required
		AttributePayload: &iot.AttributePayload{
			Attributes: map[string]*string{
				"Key": aws.String("AttributeValue"), // Required
				// More values...
			},
			Merge: aws.Bool(true),
		},
		ExpectedVersion: aws.Int64(1),
		RemoveThingType: aws.Bool(true),
		ThingTypeName:   aws.String("ThingTypeName"),
	}
	resp, err := svc.UpdateThing(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 ExampleIoT_CreateThingType() {
	svc := iot.New(session.New())

	params := &iot.CreateThingTypeInput{
		ThingTypeName: aws.String("ThingTypeName"), // Required
		ThingTypeProperties: &iot.ThingTypeProperties{
			SearchableAttributes: []*string{
				aws.String("AttributeName"), // Required
				// More values...
			},
			ThingTypeDescription: aws.String("ThingTypeDescription"),
		},
	}
	resp, err := svc.CreateThingType(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)
}
Example #9
0
func ExampleIoT_TransferCertificate() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.TransferCertificateInput{
		CertificateId:    aws.String("CertificateId"), // Required
		TargetAwsAccount: aws.String("AwsAccountId"),  // Required
		TransferMessage:  aws.String("Message"),
	}
	resp, err := svc.TransferCertificate(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)
}
Example #10
0
func ExampleIoT_UpdateCertificate() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.UpdateCertificateInput{
		CertificateId: aws.String("CertificateId"),     // Required
		NewStatus:     aws.String("CertificateStatus"), // Required
	}
	resp, err := svc.UpdateCertificate(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)
}
Example #11
0
func ExampleIoT_SetLoggingOptions() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.SetLoggingOptionsInput{
		LoggingOptionsPayload: &iot.LoggingOptionsPayload{ // Required
			RoleArn:  aws.String("AwsArn"), // Required
			LogLevel: aws.String("LogLevel"),
		},
	}
	resp, err := svc.SetLoggingOptions(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)
}
Example #12
0
func ExampleIoT_RegisterCACertificate() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.RegisterCACertificateInput{
		CaCertificate:           aws.String("CertificatePem"), // Required
		VerificationCertificate: aws.String("CertificatePem"), // Required
		AllowAutoRegistration:   aws.Bool(true),
		SetAsActive:             aws.Bool(true),
	}
	resp, err := svc.RegisterCACertificate(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)
}
Example #13
0
func ExampleIoT_ListTopicRules() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.ListTopicRulesInput{
		MaxResults:   aws.Int64(1),
		NextToken:    aws.String("NextToken"),
		RuleDisabled: aws.Bool(true),
		Topic:        aws.String("Topic"),
	}
	resp, err := svc.ListTopicRules(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)
}
Example #14
0
func ExampleIoT_GetPolicyVersion() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.GetPolicyVersionInput{
		PolicyName:      aws.String("PolicyName"),      // Required
		PolicyVersionId: aws.String("PolicyVersionId"), // Required
	}
	resp, err := svc.GetPolicyVersion(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)
}
Example #15
0
func ExampleIoT_DeleteThing() {
	sess, err := session.NewSession()
	if err != nil {
		fmt.Println("failed to create session,", err)
		return
	}

	svc := iot.New(sess)

	params := &iot.DeleteThingInput{
		ThingName:       aws.String("ThingName"), // Required
		ExpectedVersion: aws.Int64(1),
	}
	resp, err := svc.DeleteThing(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)
}
Example #16
0
func init() {
	Before("@iotdataplane", func() {
		svc := iot.New(nil)
		result, err := svc.DescribeEndpoint(&iot.DescribeEndpointInput{})
		if err != nil {
			World["error"] = err
			return
		}

		World["client"] = iotdataplane.New(aws.NewConfig().
			WithEndpoint(*result.EndpointAddress))
	})
}
Example #17
0
func init() {
	gucumber.Before("@iotdataplane", func() {
		svc := iot.New(smoke.Session)
		result, err := svc.DescribeEndpoint(&iot.DescribeEndpointInput{})
		if err != nil {
			gucumber.World["error"] = err
			return
		}

		gucumber.World["client"] = iotdataplane.New(smoke.Session, aws.NewConfig().
			WithEndpoint(*result.EndpointAddress))
	})
}
Example #18
0
func ExampleIoT_GetLoggingOptions() {
	svc := iot.New(nil)

	var params *iot.GetLoggingOptionsInput
	resp, err := svc.GetLoggingOptions(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 ExampleIoT_DescribeEndpoint() {
	svc := iot.New(session.New())

	var params *iot.DescribeEndpointInput
	resp, err := svc.DescribeEndpoint(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 ExampleIoT_GetRegistrationCode() {
	svc := iot.New(session.New())

	var params *iot.GetRegistrationCodeInput
	resp, err := svc.GetRegistrationCode(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 ExampleIoT_CreateKeysAndCertificate() {
	svc := iot.New(session.New())

	params := &iot.CreateKeysAndCertificateInput{
		SetAsActive: aws.Bool(true),
	}
	resp, err := svc.CreateKeysAndCertificate(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 ExampleIoT_ListThingPrincipals() {
	svc := iot.New(session.New())

	params := &iot.ListThingPrincipalsInput{
		ThingName: aws.String("ThingName"), // Required
	}
	resp, err := svc.ListThingPrincipals(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 ExampleIoT_CancelCertificateTransfer() {
	svc := iot.New(session.New())

	params := &iot.CancelCertificateTransferInput{
		CertificateId: aws.String("CertificateId"), // Required
	}
	resp, err := svc.CancelCertificateTransfer(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)
}
Example #24
0
func ExampleIoT_DescribeThing() {
	svc := iot.New(nil)

	params := &iot.DescribeThingInput{
		ThingName: aws.String("ThingName"), // Required
	}
	resp, err := svc.DescribeThing(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 ExampleIoT_GetTopicRule() {
	svc := iot.New(session.New())

	params := &iot.GetTopicRuleInput{
		RuleName: aws.String("RuleName"), // Required
	}
	resp, err := svc.GetTopicRule(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 ExampleIoT_DetachPrincipalPolicy() {
	svc := iot.New(session.New())

	params := &iot.DetachPrincipalPolicyInput{
		PolicyName: aws.String("PolicyName"), // Required
		Principal:  aws.String("Principal"),  // Required
	}
	resp, err := svc.DetachPrincipalPolicy(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)
}
Example #27
0
func ExampleIoT_TransferCertificate() {
	svc := iot.New(nil)

	params := &iot.TransferCertificateInput{
		CertificateId:    aws.String("CertificateId"), // Required
		TargetAwsAccount: aws.String("AwsAccountId"),  // Required
	}
	resp, err := svc.TransferCertificate(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 ExampleIoT_SetDefaultPolicyVersion() {
	svc := iot.New(session.New())

	params := &iot.SetDefaultPolicyVersionInput{
		PolicyName:      aws.String("PolicyName"),      // Required
		PolicyVersionId: aws.String("PolicyVersionId"), // Required
	}
	resp, err := svc.SetDefaultPolicyVersion(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 ExampleIoT_CreateCertificateFromCsr() {
	svc := iot.New(session.New())

	params := &iot.CreateCertificateFromCsrInput{
		CertificateSigningRequest: aws.String("CertificateSigningRequest"), // Required
		SetAsActive:               aws.Bool(true),
	}
	resp, err := svc.CreateCertificateFromCsr(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)
}
Example #30
0
func ExampleIoT_CreatePolicy() {
	svc := iot.New(nil)

	params := &iot.CreatePolicyInput{
		PolicyDocument: aws.String("PolicyDocument"), // Required
		PolicyName:     aws.String("PolicyName"),     // Required
	}
	resp, err := svc.CreatePolicy(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)
}