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


Golang iotdataplane.New函数代码示例

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


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

示例1: ExampleIoTDataPlane_UpdateThingShadow

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

	svc := iotdataplane.New(sess)

	params := &iotdataplane.UpdateThingShadowInput{
		Payload:   []byte("PAYLOAD"),       // Required
		ThingName: aws.String("ThingName"), // Required
	}
	resp, err := svc.UpdateThingShadow(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:acquia,项目名称:fifo2kinesis,代码行数:25,代码来源:examples_test.go

示例2: ExampleIoTDataPlane_Publish

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

	svc := iotdataplane.New(sess)

	params := &iotdataplane.PublishInput{
		Topic:   aws.String("Topic"), // Required
		Payload: []byte("PAYLOAD"),
		Qos:     aws.Int64(1),
	}
	resp, err := svc.Publish(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:acquia,项目名称:fifo2kinesis,代码行数:26,代码来源:examples_test.go

示例3: TestRequireEndpointUsed

func TestRequireEndpointUsed(t *testing.T) {
	svc := iotdataplane.New(unit.Session, &aws.Config{
		Region:                 aws.String("mock-region"),
		DisableParamValidation: aws.Bool(true),
		Endpoint:               aws.String("https://endpoint"),
	})
	req, _ := svc.GetThingShadowRequest(nil)
	err := req.Build()

	assert.Equal(t, "https://endpoint", svc.Endpoint)
	assert.NoError(t, err)
}
开发者ID:gombadi,项目名称:honeygot,代码行数:12,代码来源:customizations_test.go

示例4: TestRequireEndpointIfNoRegionProvided

func TestRequireEndpointIfNoRegionProvided(t *testing.T) {
	svc := iotdataplane.New(&aws.Config{
		Region:                 aws.String(""),
		DisableParamValidation: aws.Bool(true),
	})
	req, _ := svc.GetThingShadowRequest(nil)
	err := req.Build()

	assert.Equal(t, "", svc.Endpoint)
	assert.Error(t, err)
	assert.Equal(t, aws.ErrMissingEndpoint, err)
}
开发者ID:skion,项目名称:amazon-ecs-cli,代码行数:12,代码来源:customizations_test.go

示例5: init

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))
	})
}
开发者ID:ColourboxDevelopment,项目名称:aws-sdk-go,代码行数:13,代码来源:client.go

示例6: init

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))
	})
}
开发者ID:forgingdestiny,项目名称:aws-sdk-go,代码行数:13,代码来源:client.go

示例7: ExampleIoTDataPlane_GetThingShadow

func ExampleIoTDataPlane_GetThingShadow() {
	svc := iotdataplane.New(nil)

	params := &iotdataplane.GetThingShadowInput{
		ThingName: aws.String("ThingName"), // Required
	}
	resp, err := svc.GetThingShadow(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:skion,项目名称:amazon-ecs-cli,代码行数:18,代码来源:examples_test.go

示例8: TestInterface

func TestInterface(t *testing.T) {
	assert.Implements(t, (*iotdataplaneiface.IoTDataPlaneAPI)(nil), iotdataplane.New(nil))
}
开发者ID:skion,项目名称:amazon-ecs-cli,代码行数:3,代码来源:interface_test.go


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