Turning certificate actions on or off - AWS Certificate Manager
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

Turning certificate actions on or off

The following Java code example shows how to use the PutInventoryConfiguration operation to turn on certificate actions. Send the request to your organization's inventory home Region. PutInventoryConfiguration replaces the scope settings, so the example reads the current configuration first and sends the scope again. To read the state of certificate actions, call GetInventoryConfiguration, as shown in Getting the certificate inventory configuration, and read LifecycleManagement. For more information, see Turn on certificate actions.

package com.amazonaws.samples; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClientBuilder; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.model.GetInventoryConfigurationRequest; import com.amazonaws.services.certificatemanager.model.InventoryConfiguration; import com.amazonaws.services.certificatemanager.model.LifecycleManagement; import com.amazonaws.services.certificatemanager.model.PutInventoryConfigurationRequest; import com.amazonaws.services.certificatemanager.model.PutInventoryConfigurationResult; import com.amazonaws.services.certificatemanager.model.AWSCertificateManagerException; public class AWSCertificateManagerSample { public static void main(String[] args) { // Send requests to your organization's inventory home Region. AWSCertificateManager client = AWSCertificateManagerClientBuilder.standard() .withRegion("us-east-1") .build(); try { // Read the current settings, so the request keeps them. InventoryConfiguration current = client .getInventoryConfiguration(new GetInventoryConfigurationRequest()) .getConfiguration(); // Send the current scope and retention again, and turn on certificate actions. // Leave out InventoryTier and ExpiryNotification to keep them as they are. PutInventoryConfigurationRequest req = new PutInventoryConfigurationRequest() .withAccountScope(current.getAccountScope()) .withRegionalScope(current.getRegionalScope()) .withDataRetentionDays(current.getDataRetentionDays()) .withStatus("ENABLED") .withLifecycleManagement(new LifecycleManagement().withStatus("ENABLED")); PutInventoryConfigurationResult result = client.putInventoryConfiguration(req); System.out.println(result.getConfiguration().getLifecycleManagement()); } catch (AWSCertificateManagerException e) { System.err.println("Failed to turn on certificate actions: " + e.getMessage()); } } }