예제 #1
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))
	})
}
예제 #2
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)
}
예제 #3
0
func ExampleIoT_DescribeEndpoint() {
	svc := iot.New(nil)

	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)
}
예제 #4
0
func ExampleIoT_CancelCertificateTransfer() {
	svc := iot.New(nil)

	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)
}
예제 #5
0
func ExampleIoT_ListThingPrincipals() {
	svc := iot.New(nil)

	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)
}
예제 #6
0
func ExampleIoT_GetTopicRule() {
	svc := iot.New(nil)

	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)
}
예제 #7
0
func ExampleIoT_CreateKeysAndCertificate() {
	svc := iot.New(nil)

	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)
}
예제 #8
0
func ExampleIoT_SetDefaultPolicyVersion() {
	svc := iot.New(nil)

	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)
}
예제 #9
0
func ExampleIoT_DetachPrincipalPolicy() {
	svc := iot.New(nil)

	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)
}
예제 #10
0
func ExampleIoT_CreateCertificateFromCsr() {
	svc := iot.New(nil)

	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)
}
예제 #11
0
func ExampleIoT_CreatePolicyVersion() {
	svc := iot.New(nil)

	params := &iot.CreatePolicyVersionInput{
		PolicyDocument: aws.String("PolicyDocument"), // Required
		PolicyName:     aws.String("PolicyName"),     // Required
		SetAsDefault:   aws.Bool(true),
	}
	resp, err := svc.CreatePolicyVersion(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)
}
예제 #12
0
func ExampleIoT_ListPrincipalThings() {
	svc := iot.New(nil)

	params := &iot.ListPrincipalThingsInput{
		Principal:  aws.String("Principal"), // Required
		MaxResults: aws.Int64(1),
		NextToken:  aws.String("NextToken"),
	}
	resp, err := svc.ListPrincipalThings(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
0
func ExampleIoT_ListPolicies() {
	svc := iot.New(nil)

	params := &iot.ListPoliciesInput{
		AscendingOrder: aws.Bool(true),
		Marker:         aws.String("Marker"),
		PageSize:       aws.Int64(1),
	}
	resp, err := svc.ListPolicies(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
0
func ExampleIoT_SetLoggingOptions() {
	svc := iot.New(nil)

	params := &iot.SetLoggingOptionsInput{
		LoggingOptionsPayload: &iot.LoggingOptionsPayload{
			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)
}
예제 #15
0
func ExampleIoT_ListTopicRules() {
	svc := iot.New(nil)

	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)
}
예제 #16
0
func ExampleIoT_ListThings() {
	svc := iot.New(nil)

	params := &iot.ListThingsInput{
		AttributeName:  aws.String("AttributeName"),
		AttributeValue: aws.String("AttributeValue"),
		MaxResults:     aws.Int64(1),
		NextToken:      aws.String("NextToken"),
	}
	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)
}
예제 #17
0
func ExampleIoT_UpdateThing() {
	svc := iot.New(nil)

	params := &iot.UpdateThingInput{
		AttributePayload: &iot.AttributePayload{ // Required
			Attributes: map[string]*string{
				"Key": aws.String("AttributeValue"), // Required
				// More values...
			},
		},
		ThingName: aws.String("ThingName"), // Required
	}
	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)
}
예제 #18
0
func TestInterface(t *testing.T) {
	assert.Implements(t, (*iotiface.IoTAPI)(nil), iot.New(nil))
}
예제 #19
0
func ExampleIoT_ReplaceTopicRule() {
	svc := iot.New(nil)

	params := &iot.ReplaceTopicRuleInput{
		RuleName: aws.String("RuleName"), // Required
		TopicRulePayload: &iot.TopicRulePayload{ // Required
			Actions: []*iot.Action{ // Required
				{ // Required
					DynamoDB: &iot.DynamoDBAction{
						HashKeyField:  aws.String("HashKeyField"),  // Required
						HashKeyValue:  aws.String("HashKeyValue"),  // Required
						RangeKeyField: aws.String("RangeKeyField"), // Required
						RangeKeyValue: aws.String("RangeKeyValue"), // Required
						RoleArn:       aws.String("AwsArn"),        // Required
						TableName:     aws.String("TableName"),     // Required
						PayloadField:  aws.String("PayloadField"),
					},
					Firehose: &iot.FirehoseAction{
						DeliveryStreamName: aws.String("DeliveryStreamName"), // Required
						RoleArn:            aws.String("AwsArn"),             // Required
					},
					Kinesis: &iot.KinesisAction{
						RoleArn:      aws.String("AwsArn"),     // Required
						StreamName:   aws.String("StreamName"), // Required
						PartitionKey: aws.String("PartitionKey"),
					},
					Lambda: &iot.LambdaAction{
						FunctionArn: aws.String("FunctionArn"), // Required
					},
					Republish: &iot.RepublishAction{
						RoleArn: aws.String("AwsArn"),       // Required
						Topic:   aws.String("TopicPattern"), // Required
					},
					S3: &iot.S3Action{
						BucketName: aws.String("BucketName"), // Required
						Key:        aws.String("Key"),        // Required
						RoleArn:    aws.String("AwsArn"),     // Required
					},
					Sns: &iot.SnsAction{
						RoleArn:   aws.String("AwsArn"), // Required
						TargetArn: aws.String("AwsArn"), // Required
					},
					Sqs: &iot.SqsAction{
						QueueUrl:  aws.String("QueueUrl"), // Required
						RoleArn:   aws.String("AwsArn"),   // Required
						UseBase64: aws.Bool(true),
					},
				},
				// More values...
			},
			Sql:          aws.String("SQL"), // Required
			Description:  aws.String("Description"),
			RuleDisabled: aws.Bool(true),
		},
	}
	resp, err := svc.ReplaceTopicRule(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)
}