コード例 #1
0
        //批量解除多个设备与某一分组的关联关系,不会删除设备,也不会删除分组
        public void TestBatchDeleteDeviceGroupRelations()
        {
            DefaultAcsClient acsClient = Demo.IotClient.GetClient();
            String           groupId   = "AjDehc8leVvBzfW6xSl4010200";

            BatchDeleteDeviceGroupRelationsRequest request = new BatchDeleteDeviceGroupRelationsRequest();

            request.GroupId = groupId;
            List <BatchDeleteDeviceGroupRelationsRequest.Device> Devices = new List <BatchDeleteDeviceGroupRelationsRequest.Device>();

            BatchDeleteDeviceGroupRelationsRequest.Device device1 = new BatchDeleteDeviceGroupRelationsRequest.Device();
            device1.ProductKey = "a1HVMkh4YlK";
            device1.DeviceName = "device_0821_148";
            Devices.Add(device1);

            request.Devices = Devices;

            BatchDeleteDeviceGroupRelationsResponse response = acsClient.GetAcsResponse(request);

            Console.WriteLine("Batch Delete Device Group Relations: " + response.Success);
            if (!(bool)response.Success)
            {
                Console.WriteLine(response.Code + ", " + response.ErrorMessage);
                Console.ReadKey();
                return;
            }
            Console.WriteLine("AlreadyRelatedGroupDeviceCount: " + response.AlreadyRelatedGroupDeviceCount);
            Console.WriteLine("ValidDeviceCount: " + response.ValidDeviceCount);
            Console.WriteLine("SuccessAddedDeviceCount: " + response.SuccessDeviceCount);
        }
コード例 #2
0
        public static BatchDeleteDeviceGroupRelationsResponse Unmarshall(UnmarshallerContext context)
        {
            BatchDeleteDeviceGroupRelationsResponse batchDeleteDeviceGroupRelationsResponse = new BatchDeleteDeviceGroupRelationsResponse();

            batchDeleteDeviceGroupRelationsResponse.HttpResponse     = context.HttpResponse;
            batchDeleteDeviceGroupRelationsResponse.RequestId        = context.StringValue("BatchDeleteDeviceGroupRelations.RequestId");
            batchDeleteDeviceGroupRelationsResponse.Success          = context.BooleanValue("BatchDeleteDeviceGroupRelations.Success");
            batchDeleteDeviceGroupRelationsResponse.Code             = context.StringValue("BatchDeleteDeviceGroupRelations.Code");
            batchDeleteDeviceGroupRelationsResponse.ErrorMessage     = context.StringValue("BatchDeleteDeviceGroupRelations.ErrorMessage");
            batchDeleteDeviceGroupRelationsResponse.ValidDeviceCount = context.IntegerValue("BatchDeleteDeviceGroupRelations.ValidDeviceCount");
            batchDeleteDeviceGroupRelationsResponse.AlreadyRelatedGroupDeviceCount = context.IntegerValue("BatchDeleteDeviceGroupRelations.AlreadyRelatedGroupDeviceCount");
            batchDeleteDeviceGroupRelationsResponse.SuccessDeviceCount             = context.IntegerValue("BatchDeleteDeviceGroupRelations.SuccessDeviceCount");

            return(batchDeleteDeviceGroupRelationsResponse);
        }