

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 棄用物件類型
<a name="deprecate-thing-type"></a>

物件類型不可變。物件類型定義之後就無法變更。不過，您可以棄用物件類型，避免使用者將其與任何新物件建立關聯。所有與該物件類型關聯的現有物件都不會變更。

若要棄用物件類型，請使用 **DeprecateThingType** 命令：

```
$ aws iot deprecate-thing-type --thing-type-name "myThingType"
```

您可以使用 **DescribeThingType** 命令來查看結果：

```
$ aws iot describe-thing-type --thing-type-name "StopLight":
```

```
{
    "thingTypeName": "StopLight",
    "thingTypeProperties": {
        "searchableAttributes": [
            "wattage",
            "numOfLights",
            "model"
        ],
        "thingTypeDescription": "traffic light type",
    },
    "thingTypeMetadata": {
        "deprecated": true,
        "creationDate": 1468425854308,
        "deprecationDate": 1468446026349
    }
}
```

棄用物件類型是可逆的操作。您可以使用 `--undo-deprecate` 旗標以及 **DeprecateThingType** CLI 命令來取消棄用：

```
$ aws iot deprecate-thing-type --thing-type-name "myThingType" --undo-deprecate
```

您可以使用 **DescribeThingType** CLI 命令查看結果：

```
$ aws iot describe-thing-type --thing-type-name "StopLight":
```

```
{
    "thingTypeName": "StopLight",
    "thingTypeArn": "arn:aws:iot:us-east-1:123456789012:thingtype/StopLight",
    "thingTypeId": "12345678abcdefgh12345678ijklmnop12345678"
    "thingTypeProperties": {
        "searchableAttributes": [
            "wattage",
            "numOfLights",
            "model"
        ],
        "thingTypeDescription": "traffic light type"
    },
    "thingTypeMetadata": {
        "deprecated": false,
        "creationDate": 1468425854308,
    }
}
```