當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。