本文整理匯總了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)
}
示例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)
}
示例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)
}
示例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)
}
示例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))
})
}
示例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))
})
}
示例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)
}
示例8: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*iotdataplaneiface.IoTDataPlaneAPI)(nil), iotdataplane.New(nil))
}