congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AwsUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
AwsUtils
in
org.kaazing.gateway.util.aws

Best Java code snippets using org.kaazing.gateway.util.aws.AwsUtils (Showing top 8 results out of 315)

origin: kaazing/gateway

/**
 * Returns the AccountId of the user who is running the instance.
 *
 * @return String       representing the AccountId or the owner-id
 * @throws java.io.IOException  if failed to retrieve the AccountId using the
 *                      Cloud infrastructure
 */
public static String getAccountId() throws IOException {
  // Get the MAC address of the machine.
  String macUrl = getMetadataUrl() + "/network/interfaces/macs/";
  String mac = invokeUrl(macUrl).trim();
  // Use the MAC address to obtain the owner-id or the
  // AWS AccountId.
  String idUrl = macUrl + mac + "owner-id";
  String acctId = invokeUrl(idUrl).trim();
  assert  acctId != null;
  return acctId;
}
origin: kaazing/gateway

  throw new IllegalArgumentException("Conflicting multicast discovery addresses in cluster configuration");
} else if (multicastAddressesCount > 0) {
  if (AwsUtils.isDeployedToAWS() && !InternalSystemProperty.CLUSTER_BYPASS_AWS_CHECK.getBooleanProperty(gatewayConfiguration)) {
    throw new IllegalArgumentException("Multicast cluster configuration not supported on AWS, use " +
        "aws://security-group/<security-group-name> in connect tag");
  groupName = AwsUtils.getSecurityGroupName();
awsConfig.setAccessKey(connectOptions.getAwsAccessKeyId());
awsConfig.setSecretKey(connectOptions.getAwsSecretKey());
awsConfig.setRegion(AwsUtils.getRegion());
awsConfig.setSecurityGroupName(groupName);
String localIPv4 = AwsUtils.getLocalIPv4();
networkConfig.getInterfaces().setEnabled(true);
networkConfig.getInterfaces().clear();
origin: kaazing/gateway

params.put("SignatureMethod", HMAC_SHA256_ALGORITHM);
params.put("SignatureVersion", "2");
params.put("Timestamp", getTimestamp());
String canonicalQS = getV2CanonicalizedQueryString(params);
String stringToSign = requestMethod + "\n" +
           endpoint      + "\n" +
           requestURI    + "\n" +
           canonicalQS;
String signature = createSignature(stringToSign,
                  awsSecretKey,
                  HMAC_SHA256_ALGORITHM);
origin: kaazing/gateway

params.put("Timestamp", getTimestamp());
String stringToSign = getV1StringToSign(params);
String signature = createV1Signature(stringToSign,
                   awsSecretKey,
                   HMAC_SHA1_ALGORITHM);
origin: kaazing/gateway

    response = getResponse(inStream);
    inStream.close();
response = getResponse(inStream);
origin: kaazing/gateway

/**
 * Returns the local address (IPv4) of the instance.  The local address
 * is defined to be
 *       Public IP address if launched with direct addressing; private IP
 *       address if launched with public addressing.
 *
 * @return local IP address (IPv4) of the instance
 * @throws java.io.IOException
 */
public static String getLocalIPv4() throws IOException {
  String url = getMetadataUrl() + "/local-ipv4";
  String localIPv4 = invokeUrl(url);
  if ((localIPv4 == null) || (localIPv4.trim().length() == 0)) {
    String msg = "No local IPv4 assigned to the instance";
    throw new IllegalStateException(msg);
  }
  return localIPv4.trim();
}
origin: kaazing/gateway

/**
 * Returns the region in which the instance is running.
 *
 * @return String       representing the region where the instance is
 *                      running
 * @throws java.io.IOException  if failed to retrieve the region information
 *                      using the Cloud infrastructure
 */
public static String getRegion() throws IOException {
  String url = getMetadataUrl() + "/placement/availability-zone";
  String zone = invokeUrl(url);
  zone = zone.trim();
  // In case of AWS, the zone includes an extra character
  // at the end such as "us-east-1a", "us-east-1b", "eu-west-1a",
  // etc. We have to strip that last character to get the
  // correct region.
  String region = zone.substring(0, zone.length() - 1);
  assert region != null;
  return region;
}
origin: kaazing/gateway

/**
 * Returns the name of the security group from the list that is
 * obtained from the resource vendor. An instance may belong to multiple
 * security groups. And, the list of security groups obtained from the
 * vendor may not be ordered. If the vendor supports the notion of
 * a default security group, then that should be returned. Otherwise,
 * the implementation will be vendor-specific.
 *
 * @return
 * @throws java.io.IOException
 */
public static String getSecurityGroupName() throws IOException {
  // For AWS, we are returning the first security group from the list
  // that is obtained by querying the meta-data.
  String url = getMetadataUrl() + "/security-groups";
  String groups = invokeUrl(url);
  if ((groups == null) || (groups.trim().length() == 0)) {
    String msg = "No security-group assigned to the instance";
    throw new IllegalStateException(msg);
  }
  StringTokenizer tokenizer = new StringTokenizer(groups, "\n");
  return tokenizer.nextToken(); // We only need the first one.
}
org.kaazing.gateway.util.awsAwsUtils

Most used methods

  • createSignature
  • createV1Signature
  • getLocalIPv4
    Returns the local address (IPv4) of the instance. The local address is defined to be Public IP addre
  • getMetadataUrl
    Returns the URL that is used to fetch the image metadata. Based on the Cloud Vendor/Provider, this w
  • getRegion
    Returns the region in which the instance is running.
  • getResponse
  • getSecurityGroupName
    Returns the name of the security group from the list that is obtained from the resource vendor. An i
  • getTimestamp
  • getV1StringToSign
  • getV2CanonicalizedQueryString
  • invokeUrl
    This is a generic method to invoke the REST API. The URL that is passed in should result in a signed
  • isDeployedToAWS
    Indicates whether the Gateway is currently deployed in AWS environment by returning true. Otherwise,
  • invokeUrl,
  • isDeployedToAWS,
  • rfc3986Conformance

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now