Queries AWS to get the autoscaling information given the asgName.

@param asgName
- The name of the ASG.
@return - The auto scaling group information.
506936
private AutoScalingGroup retrieveAutoScalingGroup(String asgName) {
        if (Strings.isNullOrEmpty(asgName)) {
            logger.warn("null asgName specified, not attempting to retrieve AutoScalingGroup from AWS");
            return null;
        }
        // You can pass one name or a list of names in the request
        DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest()
                .withAutoScalingGroupNames(asgName);
        DescribeAutoScalingGroupsResult result = awsClient
                .describeAutoScalingGroups(request);
        List<AutoScalingGroup> asgs = result.getAutoScalingGroups();
        if (asgs.isEmpty()) {
            return null;
        } else {
            return asgs.get(0);
        }
    }
593932
@Override
    public Collection<ScalingGroup> listScalingGroups( AutoScalingGroupFilterOptions options ) throws CloudException, InternalException {
        APITrace.begin(getProvider(), "AutoScaling.listScalingGroups");
        try {
            ProviderContext ctx = getProvider().getContext();

            if( ctx == null ) {
                throw new CloudException("No context has been set for this request");
            }
            ArrayList<ScalingGroup> list = new ArrayList<ScalingGroup>();

            Map<String, String> parameters = getAutoScalingParameters(getProvider().getContext(), EC2Method.DESCRIBE_AUTO_SCALING_GROUPS);
            EC2Method method;
            NodeList blocks;
            Document doc;

            method = new EC2Method(SERVICE_ID, getProvider(), parameters);
            try {
                doc = method.invoke();
            }
            catch( EC2Exception e ) {
                logger.error(e.getSummary());
                throw new CloudException(e);
            }
            blocks = doc.getElementsByTagName("AutoScalingGroups");
            for( int i = 0; i < blocks.getLength(); i++ ) {
                NodeList items = blocks.item(i).getChildNodes();

                for( int j = 0; j < items.getLength(); j++ ) {
                    Node item = items.item(j);

                    if( item.getNodeName().equals("member") ) {
                        ScalingGroup group = toScalingGroup(ctx, item);

                        if( ( group != null && ( options != null && !options.hasCriteria() ) ) || ( group != null && ( options != null && options.hasCriteria() && options.matches(group) ) ) ) {
                            list.add(group);
                        }
                    }
                }
            }
            return list;
        }
        finally {
            APITrace.end();
        }
    }
1316298
public String getConfig(String configName)
  {
    if (config != null)
    {
      return config.getProperty(configName);
    }
    else
    {
      return null;
    }
  }
43808
def is_first_instance_aws():
    
    try:
        # get instance id and aws region
        instance_details = requests.get('http://169.254.169.254/latest/dynamic/instance-identity/document',
                                        timeout=5).json()
        instance_id = instance_details['instanceId']
        instance_region = instance_details['region']
    except (requests.RequestException, ValueError, KeyError) as e:
        raise StackInterrogationException(e)

    try:
        # get instance's autoscaling group
        autoscaling_client = boto3.client('autoscaling', region_name=instance_region)
        response = autoscaling_client.describe_auto_scaling_instances(InstanceIds=[instance_id])
        assert len(response['AutoScalingInstances']) == 1
        autoscaling_group = response['AutoScalingInstances'][0]['AutoScalingGroupName']
    except ClientError as e:
        raise StackInterrogationException(e)
    except AssertionError:
        raise InstanceNotInAsgException()

    try:
        # list in-service instances in autoscaling group
        # instances being launched or terminated should not be considered
        response = autoscaling_client.describe_auto_scaling_groups(AutoScalingGroupNames=[autoscaling_group])
        assert len(response['AutoScalingGroups']) == 1
        autoscaling_group_instance_ids = sorted(
            instance['InstanceId']
            for instance in response['AutoScalingGroups'][0]['Instances']
            if instance['LifecycleState'] == 'InService'
        )
    except (ClientError, AssertionError) as e:
        raise StackInterrogationException(e)

    return bool(autoscaling_group_instance_ids and autoscaling_group_instance_ids[0] == instance_id)
274727
public static autoscaleprofile[] get(nitro_service service) throws Exception{
		autoscaleprofile obj = new autoscaleprofile();
		autoscaleprofile[] response = (autoscaleprofile[])obj.get_resources(service);
		return response;
	}
1032916
public String getReason() {
		// Cases:
		// 1. Asymmetric because insignificant self-alignment (1itb.A_1-100)
		double tm = selfAlignment.getTMScore();
		if (tm < params.getUnrefinedScoreThreshold()) {
			return String.format("Insignificant self-alignment (TM=%.2f)", tm);
		}
		// 2. Asymmetric because order detector returned 1
		if (numRepeats == 1) {
			return String.format(
					"Order detector found asymmetric alignment (TM=%.2f)", tm);
		}

		// Check that the user requested refinement
		if (params.getRefineMethod() != RefineMethod.NOT_REFINED) {
			// 3. Asymmetric because refinement failed
			if (!refined) {
				return "Refinement failed";
			}
			tm = multipleAlignment
					.getScore(MultipleAlignmentScorer.AVGTM_SCORE);
			// 4. Asymmetric because refinement & optimization were not
			// significant
			if (!isSignificant()) {
				return String.format(
						"Refinement was not significant (TM=%.2f)", tm);
			}
		} else {
			// 4. Not refined, but result was not significant
			if (!isSignificant()) {
				return String
						.format("Result was not significant (TM=%.2f)", tm);
			}
		}

		String hierarchical = "";
		if (axes.getNumLevels() > 1) {
			hierarchical = String.format("; Contains %d levels of symmetry",
					axes.getNumLevels());
		}
		// 5. Symmetric.
		// a. Open. Give # repeats (1n0r.A)
		if (axes.getElementaryAxis(0).getSymmType() == SymmetryType.OPEN) {
			return String.format("Contains %d open repeats (TM=%.2f)%s",
					getNumRepeats(), tm, hierarchical);
		}
		// b. Closed, non-hierarchical (1itb.A)
		// c. Closed, heirarchical (4gcr)
		return String.format("Significant (TM=%.2f)%s", tm, hierarchical);
	}
1354545
public java.util.List<AutoScalingInstanceDetails> getAutoScalingInstances() {
        if (autoScalingInstances == null) {
            autoScalingInstances = new com.amazonaws.internal.SdkInternalList<AutoScalingInstanceDetails>();
        }
        return autoScalingInstances;
    }
237164
public java.util.List<String> getAwsRegions() {
        if (awsRegions == null) {
            awsRegions = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return awsRegions;
    }
495508
@com.netflix.servo.annotations.Monitor(name = "numOfASGQueries",
            description = "Number of queries made to AWS to retrieve ASG information", type = DataSourceType.COUNTER)
    public long getNumberofASGQueries() {
        return asgCache.stats().loadCount();
    }
768991
private void replicateASGInfoToReplicaNodes(final String asgName,
                                                final ASGStatus newStatus, final PeerEurekaNode node) {
        CurrentRequestVersion.set(Version.V2);
        try {
            node.statusUpdate(asgName, newStatus);
        } catch (Throwable e) {
            logger.error("Cannot replicate ASG status information to {}", node.getServiceUrl(), e);
        }
    }
1063221
public Map<String, String> getAutoScalingGroupTags(String autoScalingGroupName) {
        Preconditions.checkArgument(autoScalingGroupName != null && !autoScalingGroupName.isEmpty());
        AutoScalingGroup group = this.getAutoScalingGroup(autoScalingGroupName);
        Map<String, String> tags = new HashMap<>();
        for (TagDescription tagDescription : group.getTags()) {
            tags.put(tagDescription.getKey(), tagDescription.getValue());
        }
        return tags;
    }
975061
public TileScaling get() {
		TileScaling tileScaling = null;
		if (has()) {
			try {
				tileScaling = tileScalingDao.queryForId(tableName);
			} catch (SQLException e) {
				throw new GeoPackageException(
						"Failed to query for tile scaling for GeoPackage: "
								+ geoPackage.getName() + ", Tile Table: "
								+ tableName, e);
			}
		}
		return tileScaling;
	}
165113
@Override
    public String getAWSAccessId() {
        String aWSAccessId = configInstance.getStringProperty(
                namespace + "awsAccessId", null).get();

        if (null != aWSAccessId) {
            return aWSAccessId.trim();
        } else {
            return null;
        }

    }
630530
String regExpGroupName(String pkgName) {
        for (int j = 0; j < sortedRegExpList.size(); j++) {
            String regexp = sortedRegExpList.get(j);
            if (pkgName.startsWith(regexp)) {
                return regExpGroupMap.get(regexp);
            }
        }
        return null;
    }
599161
public Map<String, Object> getMBeanResult(final String mbeanName) {
    final Map<String, Object> ret = new HashMap<>();
    try {
      final ObjectName name = new ObjectName(mbeanName);
      final MBeanInfo info = getMBeanInfo(name);

      final MBeanAttributeInfo[] mbeanAttrs = info.getAttributes();
      final Map<String, Object> attributes = new TreeMap<>();

      for (final MBeanAttributeInfo attrInfo : mbeanAttrs) {
        final Object obj = getMBeanAttribute(name, attrInfo.getName());
        attributes.put(attrInfo.getName(), obj);
      }

      ret.put("attributes", attributes);
    } catch (final Exception e) {
      logger.error("Invalid MBean Name. name = " + mbeanName, e);
      ret.put("error", "'" + mbeanName + "' is not a valid mBean name");
    }

    return ret;
  }
1004829
public void setAutoScalingGroups(java.util.Collection<AutoScalingGroup> autoScalingGroups) {
        if (autoScalingGroups == null) {
            this.autoScalingGroups = null;
            return;
        }

        this.autoScalingGroups = new com.amazonaws.internal.SdkInternalList<AutoScalingGroup>(autoScalingGroups);
    }
484159
protected int getAsyncQueueSize(Dsn dsn) {
        return Util.parseInteger(Lookup.lookup(ASYNC_QUEUE_SIZE_OPTION, dsn), QUEUE_SIZE_DEFAULT);
    }