本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/iot.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleIoT_DeprecateThingType
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)
}
示例2: ExampleIoT_DetachThingPrincipal
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)
}
示例3: ExampleIoT_AcceptCertificateTransfer
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)
}
示例4: ExampleIoT_CreateThing
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)
}
示例5: ExampleIoT_ListThings
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)
}
示例6: ExampleIoT_ListCertificates
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)
}
示例7: ExampleIoT_UpdateThing
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)
}
示例8: ExampleIoT_CreateThingType
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)
}
示例9: ExampleIoT_TransferCertificate
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)
}
示例10: ExampleIoT_UpdateCertificate
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)
}
示例11: ExampleIoT_SetLoggingOptions
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)
}
示例12: ExampleIoT_RegisterCACertificate
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)
}
示例13: ExampleIoT_ListTopicRules
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)
}
示例14: ExampleIoT_GetPolicyVersion
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)
}
示例15: ExampleIoT_DeleteThing
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)
}