Exemples d’utilisation de l’AWS CLI avec AppRegistry
Les exemples de code suivants montrent comment réaliser des actions et mettre en œuvre des scénarios courants en utilisant l’AWS Command Line Interface avec AppRegistry.
Les actions sont des extraits de code de programmes plus larges et doivent être exécutées dans leur contexte. Alors que les actions vous indiquent comment appeler des fonctions de service individuelles, vous pouvez les voir en contexte dans leurs scénarios associés.
Chaque exemple inclut un lien vers le code source complet, où vous trouverez des instructions sur la configuration et l’exécution du code en contexte.
Rubriques
Actions
L’exemple de code suivant montre comment utiliser associate-attribute-group.
- AWS CLI
-
Pour associer un groupe d’attributs
L’exemple
associate-attribute-groupsuivant associe un groupe d’attributs spécifique de votre compte AWS à une application spécifique de votre compte AWS.aws servicecatalog-appregistry associate-attribute-group \ --application"ExampleApplication"\ --attribute-group"ExampleAttributeGroup"Sortie :
{ "applicationArn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/0ars38r6btoohvpvd9gqrptt9l", "attributeGroupArn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/01sj5xdwhbw54kejwnt09fnpcl" }Pour plus d’informations, consultez Associating and disassociating attribute groups dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez AssociateAttributeGroup
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser create-application.
- AWS CLI
-
Pour créer une application
L’exemple
create-applicationsuivant crée une application dans votre compte AWS.aws servicecatalog-appregistry create-application \ --name"ExampleApplication"Sortie :
{ "application": { "id": "0ars38r6btoohvpvd9gqrptt9l", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/0ars38r6btoohvpvd9gqrptt9l", "name": "ExampleApplication", "creationTime": "2023-02-28T21:10:10.820000+00:00", "lastUpdateTime": "2023-02-28T21:10:10.820000+00:00", "tags": {} } }Pour plus d’informations, consultez Création d’applications dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez CreateApplication
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser create-attribute-group.
- AWS CLI
-
Pour créer un groupe d’attributs
L’exemple
create-attribute-groupsuivant crée un groupe d’attributs dans votre compte AWS.aws servicecatalog-appregistry create-attribute-group \ --name"ExampleAttributeGroup"\ --attributes '{"SomeKey1":"SomeValue1","SomeKey2":"SomeValue2"}'Sortie :
{ "attributeGroup": { "id": "01sj5xdwhbw54kejwnt09fnpcl", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/01sj5xdwhbw54kejwnt09fnpcl", "name": "ExampleAttributeGroup", "creationTime": "2023-02-28T20:38:01.389000+00:00", "lastUpdateTime": "2023-02-28T20:38:01.389000+00:00", "tags": {} } }Pour plus d’informations, consultez Creating attribute groups dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez CreateAttributeGroup
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser delete-application.
- AWS CLI
-
Pour supprimer une application
L’exemple
delete-applicationsuivant supprime une application spécifique de votre compte AWS.aws servicecatalog-appregistry delete-application \ --application"ExampleApplication3"Sortie :
{ "application": { "id": "055gw7aynr1i5mbv7kjwzx5945", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/055gw7aynr1i5mbv7kjwzx5945", "name": "ExampleApplication3", "creationTime": "2023-02-28T22:06:28.228000+00:00", "lastUpdateTime": "2023-02-28T22:06:28.228000+00:00" } }Pour plus d’informations, consultez Suppression d’applications dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez DeleteApplication
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser delete-attribute-group.
- AWS CLI
-
Exemple 8 : pour supprimer un groupe d’attributs
L’exemple
delete-attribute-groupsuivant supprime un groupe d’attributs spécifique de votre compte AWS.aws servicecatalog-appregistry delete-attribute-group \ --attribute-group"ExampleAttributeGroup3"Sortie :
{ "attributeGroup": { "id": "011ge6y3emyjijt8dw8jn6r0hv", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/011ge6y3emyjijt8dw8jn6r0hv", "name": "ExampleAttributeGroup3", "creationTime": "2023-02-28T22:05:35.224000+00:00", "lastUpdateTime": "2023-02-28T22:05:35.224000+00:00" } }Pour plus d’informations, consultez Deleting attribute groups dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez DeleteAttributeGroup
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser get-application.
- AWS CLI
-
Pour obtenir une application
L’exemple
get-applicationsuivant récupère les métadonnées d’une application spécifique de votre compte AWS.aws servicecatalog-appregistry get-application \ --application"ExampleApplication"Sortie :
{ "id": "0ars38r6btoohvpvd9gqrptt9l", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/0ars38r6btoohvpvd9gqrptt9l", "name": "ExampleApplication", "creationTime": "2023-02-28T21:10:10.820000+00:00", "lastUpdateTime": "2023-02-28T21:10:10.820000+00:00", "associatedResourceCount": 0, "tags": { "aws:servicecatalog:applicationName": "ExampleApplication" }, "integrations": { "resourceGroup": { "state": "CREATE_COMPLETE", "arn": "arn:aws:resource-groups:us-west-2:813737243517:group/AWS_AppRegistry_Application-ExampleApplication" } } }Pour plus d’informations, consultez Using Application details dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez GetApplication
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser get-attribute-group.
- AWS CLI
-
Pour obtenir un groupe d’attributs
L’exemple
get-attribute-groupsuivant récupère un groupe d’attributs spécifique de votre compte AWS.aws servicecatalog-appregistry get-attribute-group \ --attribute-group"ExampleAttributeGroup"Sortie :
{ "id": "01sj5xdwhbw54kejwnt09fnpcl", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/01sj5xdwhbw54kejwnt09fnpcl", "name": "ExampleAttributeGroup", "attributes": "{\"SomeKey1\":\"SomeValue1\",\"SomeKey2\":\"SomeValue2\"}", "creationTime": "2023-02-28T20:38:01.389000+00:00", "lastUpdateTime": "2023-02-28T20:38:01.389000+00:00", "tags": { "aws:servicecatalog:attributeGroupName": "ExampleAttributeGroup" } }Pour plus d’informations, consultez Managing metadata for attribute groups dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez GetAttributeGroup
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser list-applications.
- AWS CLI
-
Pour répertorier les applications
L’exemple
list-applicationssuivant récupère la liste de toutes les applications de votre compte AWS.aws servicecatalog-appregistry list-applicationsSortie :
{ "applications": [ { "id": "03axw94pjfj3uan00tcgbrxnkw", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/03axw94pjfj3uan00tcgbrxnkw", "name": "ExampleApplication2", "creationTime": "2023-02-28T21:59:34.094000+00:00", "lastUpdateTime": "2023-02-28T21:59:34.094000+00:00" }, { "id": "055gw7aynr1i5mbv7kjwzx5945", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/055gw7aynr1i5mbv7kjwzx5945", "name": "ExampleApplication3", "creationTime": "2023-02-28T22:06:28.228000+00:00", "lastUpdateTime": "2023-02-28T22:06:28.228000+00:00" }, { "id": "0ars38r6btoohvpvd9gqrptt9l", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/0ars38r6btoohvpvd9gqrptt9l", "name": "ExampleApplication", "description": "This is an example application", "creationTime": "2023-02-28T21:10:10.820000+00:00", "lastUpdateTime": "2023-02-28T21:24:19.729000+00:00" } ] }Pour plus d’informations, consultez Viewing application details dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez ListApplications
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser list-associated-attribute-groups.
- AWS CLI
-
Pour répertorier les groupes d’attributs associés
L’exemple
list-associated-attribute-groupssuivant récupère la liste de tous les groupes d’attributs de votre compte AWS associés à une application spécifique de votre compte AWS.aws servicecatalog-appregistry list-associated-attribute-groups \ --application"ExampleApplication"Sortie :
{ "attributeGroups": [ "01sj5xdwhbw54kejwnt09fnpcl" ] }Pour plus d’informations, consultez Associating and disassociating attribute groups dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez ListAssociatedAttributeGroups
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser list-attribute-groups-for-application.
- AWS CLI
-
Pour répertorier les groupes d’attributs d’une application
L’exemple
list-attribute-groups-for-applicationsuivant répertorie les détails de tous les groupes d’attributs de votre compte AWS associés à une application spécifique de votre compte AWS.aws servicecatalog-appregistry list-attribute-groups-for-application \ --application"ExampleApplication"Sortie :
{ "attributeGroupsDetails": [ { "id": "01sj5xdwhbw54kejwnt09fnpcl", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/01sj5xdwhbw54kejwnt09fnpcl", "name": "ExampleAttributeGroup" } ] }Pour plus d’informations, consultez Viewing attribute group details
dans le Guide de l’administrateur AWS Service Catalog AppRegistry. -
Pour plus de détails sur l’API, consultez ListAttributeGroupsForApplication
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser list-attribute-groups.
- AWS CLI
-
Pour répertorier les groupes d’attributs
L’exemple
list-attribute-groupssuivant récupère la liste de tous les groupes d’attributs de votre compte AWS.aws servicecatalog-appregistry list-attribute-groupsSortie :
{ "attributeGroups": [ { "id": "011ge6y3emyjijt8dw8jn6r0hv", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/011ge6y3emyjijt8dw8jn6r0hv", "name": "ExampleAttributeGroup3", "creationTime": "2023-02-28T22:05:35.224000+00:00", "lastUpdateTime": "2023-02-28T22:05:35.224000+00:00" }, { "id": "01sj5xdwhbw54kejwnt09fnpcl", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/01sj5xdwhbw54kejwnt09fnpcl", "name": "ExampleAttributeGroup", "description": "This is an example attribute group", "creationTime": "2023-02-28T20:38:01.389000+00:00", "lastUpdateTime": "2023-02-28T21:02:04.559000+00:00" }, { "id": "03n1yffgq6d18vwrzxf0c70nm3", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/03n1yffgq6d18vwrzxf0c70nm3", "name": "ExampleAttributeGroup2", "creationTime": "2023-02-28T21:57:30.687000+00:00", "lastUpdateTime": "2023-02-28T21:57:30.687000+00:00" } ] }Pour plus d’informations, consultez Viewing attribute group details dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez ListAttributeGroups
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser update-application.
- AWS CLI
-
Pour mettre à jour une application
L’exemple
update-applicationsuivant met à jour une application spécifique de votre compte AWS pour y inclure une description.aws servicecatalog-appregistry update-application \ --application"ExampleApplication"\ --description"This is an example application"Sortie :
{ "application": { "id": "0ars38r6btoohvpvd9gqrptt9l", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/applications/0ars38r6btoohvpvd9gqrptt9l", "name": "ExampleApplication", "description": "This is an example application", "creationTime": "2023-02-28T21:10:10.820000+00:00", "lastUpdateTime": "2023-02-28T21:24:19.729000+00:00", "tags": { "aws:servicecatalog:applicationName": "ExampleApplication" } } }Pour plus d’informations, consultez Modification d’applications dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez UpdateApplication
dans la Référence des commandes de l’AWS CLI.
-
L’exemple de code suivant montre comment utiliser update-attribute-group.
- AWS CLI
-
Pour mettre à jour un groupe d’attributs
L’exemple
update-attribute-groupsuivant met à jour un groupe d’attributs spécifique de votre compte AWS pour y inclure une description.aws servicecatalog-appregistry update-attribute-group \ --attribute-group"ExampleAttributeGroup"\ --description"This is an example attribute group"Sortie :
{ "attributeGroup": { "id": "01sj5xdwhbw54kejwnt09fnpcl", "arn": "arn:aws:servicecatalog:us-west-2:813737243517:/attribute-groups/01sj5xdwhbw54kejwnt09fnpcl", "name": "ExampleAttributeGroup", "description": "This is an example attribute group", "creationTime": "2023-02-28T20:38:01.389000+00:00", "lastUpdateTime": "2023-02-28T21:02:04.559000+00:00", "tags": { "aws:servicecatalog:attributeGroupName": "ExampleAttributeGroup" } } }Pour plus d’informations, consultez Editing attribute groups dans le Guide de l’administrateur AWS Service Catalog AppRegistry.
-
Pour plus de détails sur l’API, consultez UpdateAttributeGroup
dans la Référence des commandes de l’AWS CLI.
-