Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
Utilisation UpdateIndexingConfiguration
avec un AWS SDK ou une CLI
Les exemples de code suivants illustrent comment utiliser UpdateIndexingConfiguration
.
- C++
-
- Kit de développement logiciel (SDK) for C++
-
//! 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();
}
- CLI
-
- AWS CLI
-
Pour activer l'indexation des objets
L'update-indexing-configuration
exemple suivant active l'indexation des objets pour prendre en charge la recherche dans les données de registre, les données fictives et l'état de connectivité des objets à l'aide de l'index AWS_Things.
aws iot update-indexing-configuration
--thing-indexing-configuration thingIndexingMode=REGISTRY_AND_SHADOW,thingConnectivityIndexingMode=STATUS
Cette commande ne produit aucun résultat.
Pour plus d'informations, consultez la section Managing Thing Indexing dans le Guide du développeur AWS IoT.
Pour obtenir la liste complète des guides de développement du AWS SDK et des exemples de code, consultezUtilisation AWS IoT avec un AWS SDK. Cette rubrique comprend également des informations sur le démarrage et sur les versions précédentes de SDK.