Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
Verwendung UpdateIndexingConfiguration mit einem AWS SDK oder CLI
Die folgenden Code-Beispiele zeigen, wie UpdateIndexingConfiguration verwendet wird.
- C++
-
- SDK für C++
-
Anmerkung
Es gibt noch mehr dazu GitHub. Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. //! Update the indexing configuration. /*! \param thingIndexingConfiguration: A ThingIndexingConfiguration object which is ignored if not set. \param thingGroupIndexingConfiguration: A ThingGroupIndexingConfiguration object which is ignored if not set. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::IoT::updateIndexingConfiguration( const Aws::IoT::Model::ThingIndexingConfiguration &thingIndexingConfiguration, const Aws::IoT::Model::ThingGroupIndexingConfiguration &thingGroupIndexingConfiguration, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::IoT::IoTClient iotClient(clientConfiguration); Aws::IoT::Model::UpdateIndexingConfigurationRequest request; if (thingIndexingConfiguration.ThingIndexingModeHasBeenSet()) { request.SetThingIndexingConfiguration(thingIndexingConfiguration); } if (thingGroupIndexingConfiguration.ThingGroupIndexingModeHasBeenSet()) { request.SetThingGroupIndexingConfiguration(thingGroupIndexingConfiguration); } Aws::IoT::Model::UpdateIndexingConfigurationOutcome outcome = iotClient.UpdateIndexingConfiguration( request); if (outcome.IsSuccess()) { std::cout << "UpdateIndexingConfiguration succeeded." << std::endl; } else { std::cerr << "UpdateIndexingConfiguration failed." << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }-
Einzelheiten zur API finden Sie UpdateIndexingConfigurationin der AWS SDK für C++ API-Referenz.
-
- CLI
-
- AWS CLI
-
So aktivieren Sie die Indizierung von Objekten
Im folgenden
update-indexing-configurationBeispiel wird die Dingindizierung aktiviert, sodass die Suche nach Registrierungsdaten, Shadow-Daten und dem Status der Ding-Konnektivität mithilfe des AWS_Things-Index unterstützt wird.aws iot update-indexing-configuration --thing-indexing-configurationthingIndexingMode=REGISTRY_AND_SHADOW,thingConnectivityIndexingMode=STATUSMit diesem Befehl wird keine Ausgabe zurückgegeben.
Weitere Informationen finden Sie unter Verwalten der Objektindizierung im Entwicklerhandbuch für AWS IoT.
-
Einzelheiten zur API finden Sie UpdateIndexingConfiguration
in der AWS CLI Befehlsreferenz.
-
- Python
-
- SDK für Python (Boto3)
-
Anmerkung
Es gibt noch mehr dazu GitHub. Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS -Code-Beispiel-
einrichten und ausführen. class IoTWrapper: """Encapsulates AWS IoT actions.""" def __init__(self, iot_client, iot_data_client=None): """ :param iot_client: A Boto3 AWS IoT client. :param iot_data_client: A Boto3 AWS IoT Data Plane client. """ self.iot_client = iot_client self.iot_data_client = iot_data_client @classmethod def from_client(cls): iot_client = boto3.client("iot") iot_data_client = boto3.client("iot-data") return cls(iot_client, iot_data_client) def update_indexing_configuration(self): """ Updates the AWS IoT indexing configuration to enable thing indexing. """ try: self.iot_client.update_indexing_configuration( thingIndexingConfiguration={"thingIndexingMode": "REGISTRY"} ) logger.info("Updated indexing configuration.") except ClientError as err: logger.error( "Couldn't update indexing configuration. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise-
Einzelheiten zur API finden Sie UpdateIndexingConfigurationin AWS SDK for Python (Boto3) API Reference.
-
Eine vollständige Liste der AWS SDK-Entwicklerhandbücher und Codebeispiele finden Sie unter. Verwendung AWS IoT mit einem SDK AWS Dieses Thema enthält auch Informationen zu den ersten Schritten und Details zu früheren SDK-Versionen.