From 189f6920ad1bb50c77efd65dc9dd0a770aaf9cc4 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Fri, 2 Feb 2024 05:40:51 +0000 Subject: [PATCH] Generated 2018-01-20 for Iot. --- ChangeLog.txt | 4 + ...uct_failure_topics_in_unsubscribe_topic.go | 21 ++++ services/iot/unsubscribe_topic.go | 108 ++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 services/iot/struct_failure_topics_in_unsubscribe_topic.go create mode 100644 services/iot/unsubscribe_topic.go diff --git a/ChangeLog.txt b/ChangeLog.txt index 3c8b67a99..1412d5d25 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +2024-02-02 Version: v1.62.675 +- Generated 2018-01-20 for `Iot`. +- Add UnsubscribeTopic. + 2024-02-02 Version: v1.62.674 - Generated 2022-05-30 for `eflo`. - Support error message for vcc route entry. diff --git a/services/iot/struct_failure_topics_in_unsubscribe_topic.go b/services/iot/struct_failure_topics_in_unsubscribe_topic.go new file mode 100644 index 000000000..a527270d1 --- /dev/null +++ b/services/iot/struct_failure_topics_in_unsubscribe_topic.go @@ -0,0 +1,21 @@ +package iot + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// FailureTopicsInUnsubscribeTopic is a nested struct in iot response +type FailureTopicsInUnsubscribeTopic struct { + Topic []map[string]interface{} `json:"topic" xml:"topic"` +} diff --git a/services/iot/unsubscribe_topic.go b/services/iot/unsubscribe_topic.go new file mode 100644 index 000000000..20cebb2b9 --- /dev/null +++ b/services/iot/unsubscribe_topic.go @@ -0,0 +1,108 @@ +package iot + +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UnsubscribeTopic invokes the iot.UnsubscribeTopic API synchronously +func (client *Client) UnsubscribeTopic(request *UnsubscribeTopicRequest) (response *UnsubscribeTopicResponse, err error) { + response = CreateUnsubscribeTopicResponse() + err = client.DoAction(request, response) + return +} + +// UnsubscribeTopicWithChan invokes the iot.UnsubscribeTopic API asynchronously +func (client *Client) UnsubscribeTopicWithChan(request *UnsubscribeTopicRequest) (<-chan *UnsubscribeTopicResponse, <-chan error) { + responseChan := make(chan *UnsubscribeTopicResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UnsubscribeTopic(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UnsubscribeTopicWithCallback invokes the iot.UnsubscribeTopic API asynchronously +func (client *Client) UnsubscribeTopicWithCallback(request *UnsubscribeTopicRequest, callback func(response *UnsubscribeTopicResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UnsubscribeTopicResponse + var err error + defer close(result) + response, err = client.UnsubscribeTopic(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UnsubscribeTopicRequest is the request struct for api UnsubscribeTopic +type UnsubscribeTopicRequest struct { + *requests.RpcRequest + IotInstanceId string `position:"Query" name:"IotInstanceId"` + ProductKey string `position:"Query" name:"ProductKey"` + ApiProduct string `position:"Body" name:"ApiProduct"` + Topic *[]string `position:"Query" name:"Topic" type:"Repeated"` + ApiRevision string `position:"Body" name:"ApiRevision"` + DeviceName string `position:"Query" name:"DeviceName"` +} + +// UnsubscribeTopicResponse is the response struct for api UnsubscribeTopic +type UnsubscribeTopicResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Success bool `json:"Success" xml:"Success"` + Code string `json:"Code" xml:"Code"` + ErrorMessage string `json:"ErrorMessage" xml:"ErrorMessage"` + FailureTopics FailureTopicsInUnsubscribeTopic `json:"FailureTopics" xml:"FailureTopics"` +} + +// CreateUnsubscribeTopicRequest creates a request to invoke UnsubscribeTopic API +func CreateUnsubscribeTopicRequest() (request *UnsubscribeTopicRequest) { + request = &UnsubscribeTopicRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Iot", "2018-01-20", "UnsubscribeTopic", "iot", "openAPI") + request.Method = requests.POST + return +} + +// CreateUnsubscribeTopicResponse creates a response to parse from UnsubscribeTopic response +func CreateUnsubscribeTopicResponse() (response *UnsubscribeTopicResponse) { + response = &UnsubscribeTopicResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +}