Example usage for com.amazonaws.services.autoscaling.model DeleteLaunchConfigurationRequest setLaunchConfigurationName

List of usage examples for com.amazonaws.services.autoscaling.model DeleteLaunchConfigurationRequest setLaunchConfigurationName

Introduction

In this page you can find the example usage for com.amazonaws.services.autoscaling.model DeleteLaunchConfigurationRequest setLaunchConfigurationName.

Prototype


public void setLaunchConfigurationName(String launchConfigurationName) 

Source Link

Document

The name of the launch configuration.

Usage

From source file:com.liferay.amazontools.AMICleaner.java

License:Open Source License

protected void deleteOldLaunchConfigurations() {
    DescribeLaunchConfigurationsRequest describeLaunchConfigurationsRequest = new DescribeLaunchConfigurationsRequest();

    DescribeLaunchConfigurationsResult describeLaunchConfigurationsResult = amazonAutoScalingClient
            .describeLaunchConfigurations(describeLaunchConfigurationsRequest);

    List<LaunchConfiguration> launchConfigurations = describeLaunchConfigurationsResult
            .getLaunchConfigurations();//from w w w  . j  ava2  s . com

    for (int i = 0; i < launchConfigurations.size(); i++) {
        DeleteLaunchConfigurationRequest deleteLaunchConfigurationRequest = new DeleteLaunchConfigurationRequest();

        LaunchConfiguration launchConfiguration = launchConfigurations.get(i);

        deleteLaunchConfigurationRequest
                .setLaunchConfigurationName(launchConfiguration.getLaunchConfigurationName());

        try {
            amazonAutoScalingClient.deleteLaunchConfiguration(deleteLaunchConfigurationRequest);
        } catch (ResourceInUseException riue) {
        }
    }
}

From source file:com.pinterest.arcee.autoscaling.AwsAutoScaleGroupManager.java

License:Apache License

@Override
public void deleteLaunchConfig(String ConfigId) throws Exception {
    try {//from  w w w.java  2s  . c o m
        if (ConfigId == null) {
            return;
        }

        DeleteLaunchConfigurationRequest request = new DeleteLaunchConfigurationRequest();
        request.setLaunchConfigurationName(ConfigId);
        aasClient.deleteLaunchConfiguration(request);
    } catch (AmazonClientException e) {
        LOG.error(e.getMessage());
    }
}

From source file:com.pinterest.arcee.autoscaling.AwsAutoScalingManager.java

License:Apache License

@Override
public void deleteLaunchConfig(String launchConfig) throws Exception {
    try {/*from  w  w  w .j  a  va  2s .co  m*/
        if (launchConfig == null) {
            return;
        }

        DeleteLaunchConfigurationRequest request = new DeleteLaunchConfigurationRequest();
        request.setLaunchConfigurationName(launchConfig);
        aasClient.deleteLaunchConfiguration(request);
    } catch (AmazonServiceException e) {
        // if the launch config not found, or still in use. siliently ignore the error
        if (e.getErrorType() != AmazonServiceException.ErrorType.Client) {
            throw e;
        }
    }
}

From source file:com.pinterest.clusterservice.cm.AwsVmManager.java

License:Apache License

private void deleteLaunchConfig(String launchConfigId) throws Exception {
    try {/*from   w ww. j a  va2 s .c o m*/
        DeleteLaunchConfigurationRequest deleteRequest = new DeleteLaunchConfigurationRequest();
        deleteRequest.setLaunchConfigurationName(launchConfigId);
        aasClient.deleteLaunchConfiguration(deleteRequest);
    } catch (AmazonClientException e) {
        LOG.error(String.format("Failed to delete launch config id %s: %s", launchConfigId, e.getMessage()));
        throw new Exception(
                String.format("Failed to delete launch config id %s: %s", launchConfigId, e.getMessage()));
    }
}