Seleziona le tue preferenze relative ai cookie

Utilizziamo cookie essenziali e strumenti simili necessari per fornire il nostro sito e i nostri servizi. Utilizziamo i cookie prestazionali per raccogliere statistiche anonime in modo da poter capire come i clienti utilizzano il nostro sito e apportare miglioramenti. I cookie essenziali non possono essere disattivati, ma puoi fare clic su \"Personalizza\" o \"Rifiuta\" per rifiutare i cookie prestazionali.

Se sei d'accordo, AWS e le terze parti approvate utilizzeranno i cookie anche per fornire utili funzionalità del sito, ricordare le tue preferenze e visualizzare contenuti pertinenti, inclusa la pubblicità pertinente. Per continuare senza accettare questi cookie, fai clic su \"Continua\" o \"Rifiuta\". Per effettuare scelte più dettagliate o saperne di più, fai clic su \"Personalizza\".

Pulizia dell'ambiente

Modalità Focus
Pulizia dell'ambiente - AWS AppConfig

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Se hai eseguito uno o più esempi di codice in questa sezione, ti consigliamo di utilizzare uno dei seguenti esempi per individuare ed eliminare le AWS AppConfig risorse create da tali esempi di codice. Gli esempi in questa sezione richiamano quanto segue APIs:

Java
/* This sample provides cleanup code that deletes all the AWS AppConfig resources created in the samples above. WARNING: this code will permanently delete the given application and all of its sub-resources, including configuration profiles, hosted configuration versions, and environments. DO NOT run this code against an application that you may need in the future. */ public void cleanUpDemoResources() { AppConfigClient appconfig = AppConfigClient.create(); // The name of the application to delete // IMPORTANT: verify this name corresponds to the application you wish to delete String applicationToDelete = "MyDemoApp"; appconfig.listApplicationsPaginator(ListApplicationsRequest.builder().build()).items().forEach(app -> { if (app.name().equals(applicationToDelete)) { System.out.println("Deleting App: " + app); appconfig.listConfigurationProfilesPaginator(req -> req.applicationId(app.id())).items().forEach(cp -> { System.out.println("Deleting Profile: " + cp); appconfig .listHostedConfigurationVersionsPaginator(req -> req .applicationId(app.id()) .configurationProfileId(cp.id())) .items() .forEach(hcv -> { System.out.println("Deleting HCV: " + hcv); appconfig.deleteHostedConfigurationVersion(req -> req .applicationId(app.id()) .configurationProfileId(cp.id()) .versionNumber(hcv.versionNumber())); }); appconfig.deleteConfigurationProfile(req -> req .applicationId(app.id()) .configurationProfileId(cp.id())); }); appconfig.listEnvironmentsPaginator(req->req.applicationId(app.id())).items().forEach(env -> { System.out.println("Deleting Environment: " + env); appconfig.deleteEnvironment(req->req.applicationId(app.id()).environmentId(env.id())); }); appconfig.deleteApplication(req -> req.applicationId(app.id())); } }); }
Python
# this sample provides cleanup code that deletes all the AWS AppConfig resources created in the samples above. # # WARNING: this code will permanently delete the given application and all of its sub-resources, including # configuration profiles, hosted configuration versions, and environments. DO NOT run this code against # an application that you may need in the future. # import boto3 # the name of the application to delete # IMPORTANT: verify this name corresponds to the application you wish to delete application_name = 'MyDemoApp' # create and iterate over a list paginator such that we end up with a list of pages, which are themselves lists of applications # e.g. [ [{'Name':'MyApp1',...},{'Name':'MyApp2',...}], [{'Name':'MyApp3',...}] ] list_of_app_lists = [page['Items'] for page in appconfig.get_paginator('list_applications').paginate()] # retrieve the target application from the list of lists application = [app for apps in list_of_app_lists for app in apps if app['Name'] == application_name][0] print(f"deleting application {application['Name']} (id={application['Id']})") # delete all configuration profiles list_of_config_lists = [page['Items'] for page in appconfig.get_paginator('list_configuration_profiles').paginate(ApplicationId=application['Id'])] for config_profile in [config for configs in list_of_config_lists for config in configs]: print(f"\tdeleting configuration profile {config_profile['Name']} (Id={config_profile['Id']})") # delete all hosted configuration versions list_of_hcv_lists = [page['Items'] for page in appconfig.get_paginator('list_hosted_configuration_versions').paginate(ApplicationId=application['Id'], ConfigurationProfileId=config_profile['Id'])] for hcv in [hcv for hcvs in list_of_hcv_lists for hcv in hcvs]: appconfig.delete_hosted_configuration_version(ApplicationId=application['Id'], ConfigurationProfileId=config_profile['Id'], VersionNumber=hcv['VersionNumber']) print(f"\t\tdeleted hosted configuration version {hcv['VersionNumber']}") # delete the config profile itself appconfig.delete_configuration_profile(ApplicationId=application['Id'], ConfigurationProfileId=config_profile['Id']) print(f"\tdeleted configuration profile {config_profile['Name']} (Id={config_profile['Id']})") # delete all environments list_of_env_lists = [page['Items'] for page in appconfig.get_paginator('list_environments').paginate(ApplicationId=application['Id'])] for environment in [env for envs in list_of_env_lists for env in envs]: appconfig.delete_environment(ApplicationId=application['Id'], EnvironmentId=environment['Id']) print(f"\tdeleted environment {environment['Name']} (Id={environment['Id']})") # delete the application itself appconfig.delete_application(ApplicationId=application['Id']) print(f"deleted application {application['Name']} (id={application['Id']})")
JavaScript
// this sample provides cleanup code that deletes all the AWS AppConfig resources created in the samples above. // WARNING: this code will permanently delete the given application and all of its sub-resources, including // configuration profiles, hosted configuration versions, and environments. DO NOT run this code against // an application that you may need in the future. import { AppConfigClient, paginateListApplications, DeleteApplicationCommand, paginateListConfigurationProfiles, DeleteConfigurationProfileCommand, paginateListHostedConfigurationVersions, DeleteHostedConfigurationVersionCommand, paginateListEnvironments, DeleteEnvironmentCommand, } from "@aws-sdk/client-appconfig"; const client = new AppConfigClient(); // the name of the application to delete // IMPORTANT: verify this name corresponds to the application you wish to delete const application_name = "MyDemoApp"; // iterate over all applications, deleting ones that have the name defined above for await (const app_page of paginateListApplications({ client }, {})) { for (const application of app_page.Items) { // skip applications that dont have the name thats set if (application.Name !== application_name) continue; console.log( `deleting application ${application.Name} (id=${application.Id})`); // delete all configuration profiles for await (const config_page of paginateListConfigurationProfiles({ client }, { ApplicationId: application.Id })) { for (const config_profile of config_page.Items) { console.log(`\tdeleting configuration profile ${config_profile.Name} (Id=${config_profile.Id})`); // delete all hosted configuration versions for await (const hosted_page of paginateListHostedConfigurationVersions({ client }, { ApplicationId: application.Id, ConfigurationProfileId: config_profile.Id } )) { for (const hosted_config_version of hosted_page.Items) { await client.send( new DeleteHostedConfigurationVersionCommand({ ApplicationId: application.Id, ConfigurationProfileId: config_profile.Id, VersionNumber: hosted_config_version.VersionNumber, }) ); console.log(`\t\tdeleted hosted configuration version ${hosted_config_version.VersionNumber}`); } } // delete the config profile itself await client.send( new DeleteConfigurationProfileCommand({ ApplicationId: application.Id, ConfigurationProfileId: config_profile.Id, }) ); console.log(`\tdeleted configuration profile ${config_profile.Name} (Id=${config_profile.Id})`) } // delete all environments for await (const env_page of paginateListEnvironments({ client }, { ApplicationId: application.Id })) { for (const environment of env_page.Items) { await client.send( new DeleteEnvironmentCommand({ ApplicationId: application.Id, EnvironmentId: environment.Id, }) ); console.log(`\tdeleted environment ${environment.Name} (Id=${environment.Id})`) } } } // delete the application itself await client.send( new DeleteApplicationCommand({ ApplicationId: application.Id }) ); console.log(`deleted application ${application.Name} (id=${application.Id})`) } }
/* This sample provides cleanup code that deletes all the AWS AppConfig resources created in the samples above. WARNING: this code will permanently delete the given application and all of its sub-resources, including configuration profiles, hosted configuration versions, and environments. DO NOT run this code against an application that you may need in the future. */ public void cleanUpDemoResources() { AppConfigClient appconfig = AppConfigClient.create(); // The name of the application to delete // IMPORTANT: verify this name corresponds to the application you wish to delete String applicationToDelete = "MyDemoApp"; appconfig.listApplicationsPaginator(ListApplicationsRequest.builder().build()).items().forEach(app -> { if (app.name().equals(applicationToDelete)) { System.out.println("Deleting App: " + app); appconfig.listConfigurationProfilesPaginator(req -> req.applicationId(app.id())).items().forEach(cp -> { System.out.println("Deleting Profile: " + cp); appconfig .listHostedConfigurationVersionsPaginator(req -> req .applicationId(app.id()) .configurationProfileId(cp.id())) .items() .forEach(hcv -> { System.out.println("Deleting HCV: " + hcv); appconfig.deleteHostedConfigurationVersion(req -> req .applicationId(app.id()) .configurationProfileId(cp.id()) .versionNumber(hcv.versionNumber())); }); appconfig.deleteConfigurationProfile(req -> req .applicationId(app.id()) .configurationProfileId(cp.id())); }); appconfig.listEnvironmentsPaginator(req->req.applicationId(app.id())).items().forEach(env -> { System.out.println("Deleting Environment: " + env); appconfig.deleteEnvironment(req->req.applicationId(app.id()).environmentId(env.id())); }); appconfig.deleteApplication(req -> req.applicationId(app.id())); } }); }
PrivacyCondizioni del sitoPreferenze cookie
© 2025, Amazon Web Services, Inc. o società affiliate. Tutti i diritti riservati.