Examples of GetMetricStatistics


Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

   }
  
   @SuppressWarnings("unchecked")
   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
      GetMetricStatistics getRequest = GetMetricStatistics.class.cast(checkNotNull(payload,
               "GetMetricStatistics must be set!"));
      int dimensionIndex = 1;
      int statisticIndex = 1;
      ImmutableMultimap.Builder<String, String> formParameters = ImmutableMultimap.builder();

      for (Dimension dimension : getRequest.getDimensions()) {
         formParameters.put("Dimensions.member." + dimensionIndex + ".Name", dimension.getName());
         formParameters.put("Dimensions.member." + dimensionIndex + ".Value", dimension.getValue());
         dimensionIndex++;
      }

      if (getRequest.getEndTime().isPresent()) {
         formParameters.put("EndTime", dateService.iso8601SecondsDateFormat(getRequest.getEndTime().get()));
      }
      formParameters.put("MetricName", getRequest.getMetricName());
      formParameters.put("Namespace", getRequest.getNamespace());
      formParameters.put("Period", Integer.toString(getRequest.getPeriod()));
      if (getRequest.getStartTime().isPresent()) {
         formParameters.put("StartTime", dateService.iso8601SecondsDateFormat(getRequest
                  .getStartTime().get()));
      }
     
      for (Statistics statistic : getRequest.getStatistics()) {
         formParameters.put("Statistics.member." + statisticIndex, statistic.toString());
         statisticIndex++;
      }

      if (getRequest.getUnit().isPresent()) {
         formParameters.put("Unit", getRequest.getUnit().get().toString());
      }

      return (R) request.toBuilder().replaceFormParams(formParameters.build()).build();
   }
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

   }
  
   @SuppressWarnings("unchecked")
   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
      GetMetricStatistics getRequest = GetMetricStatistics.class.cast(checkNotNull(payload,
               "GetMetricStatistics must be set!"));
      int dimensionIndex = 1;
      int statisticIndex = 1;
      ImmutableMultimap.Builder<String, String> formParameters = ImmutableMultimap.builder();

      for (Dimension dimension : getRequest.getDimensions()) {
         formParameters.put("Dimensions.member." + dimensionIndex + ".Name", dimension.getName());
         formParameters.put("Dimensions.member." + dimensionIndex + ".Value", dimension.getValue());
         dimensionIndex++;
      }

      if (getRequest.getEndTime().isPresent()) {
         formParameters.put("EndTime", dateService.iso8601SecondsDateFormat(getRequest.getEndTime().get()));
      }
      formParameters.put("MetricName", getRequest.getMetricName());
      formParameters.put("Namespace", getRequest.getNamespace());
      formParameters.put("Period", Integer.toString(getRequest.getPeriod()));
      if (getRequest.getStartTime().isPresent()) {
         formParameters.put("StartTime", dateService.iso8601SecondsDateFormat(getRequest
                  .getStartTime().get()));
      }
     
      for (Statistics statistic : getRequest.getStatistics()) {
         formParameters.put("Statistics.member." + statisticIndex, statistic.toString());
         statisticIndex++;
      }

      if (getRequest.getUnit().isPresent()) {
         formParameters.put("Unit", getRequest.getUnit().get().toString());
      }

      return (R) request.toBuilder().replaceFormParams(formParameters.build()).build();
   }
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

      IterableWithMarker<Metric> lmr = api().list(lmo);
      Date endTime = new Date(metricTimestampInCloudWatch.getTime() + (60 * 1000)); // Pad a minute just in case
      Date startTime = new Date(metricTimestampInCloudWatch.getTime() - (60 * 1000)); // Pad a minute just in case

      for (Metric m : lmr) {
         GetMetricStatistics gms = GetMetricStatistics.builder()
                                                      .dimensions(m.getDimensions())
                                                      .namespace(namespace)
                                                      .metricName(m.getMetricName())
                                                      .endTime(endTime)
                                                      .statistic(Statistics.MAXIMUM)
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

               Date endTime = new Date();
               Calendar cal = Calendar.getInstance();

               cal.add(Calendar.MINUTE, -60 * 24); // 24 hours

               GetMetricStatistics options =
                     GetMetricStatistics.builder()
                                                 .dimension(dimension)
                                                 .endTime(endTime)
                                                 .metricName(metric.getMetricName())
                                                 .namespace(metric.getNamespace())
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

      IterableWithMarker<Metric> lmr = api().list(lmo);
      Date endTime = new Date(metricTimestampInCloudWatch.getTime() + (60 * 1000)); // Pad a minute just in case
      Date startTime = new Date(metricTimestampInCloudWatch.getTime() - (60 * 1000)); // Pad a minute just in case

      for (Metric m : lmr) {
         GetMetricStatistics gms = GetMetricStatistics.builder()
                                                      .dimensions(m.getDimensions())
                                                      .namespace(namespace)
                                                      .metricName(m.getMetricName())
                                                      .endTime(endTime)
                                                      .statistic(Statistics.MAXIMUM)
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

               Date endTime = new Date();
               Calendar cal = Calendar.getInstance();

               cal.add(Calendar.MINUTE, -60 * 24); // 24 hours

               GetMetricStatistics options =
                     GetMetricStatistics.builder()
                                                 .dimension(dimension)
                                                 .endTime(endTime)
                                                 .metricName(metric.getMetricName())
                                                 .namespace(metric.getNamespace())
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

         return null;
      }

      Date endDate = new Date(); // Now
      Date startDate = new Date(endDate.getTime() - (1000 * 60 * 60 * 24)); // One day ago
      GetMetricStatistics statistics = GetMetricStatistics.builder()
                                                          // Specify the instance id you're interested in
                                                          .dimension(instanceIdDimension)
                                                          // Specify the metric name you're interested in
                                                          .metricName(EC2Constants.MetricName.CPU_UTILIZATION)
                                                          // Specify the namespace of the metric
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

   }
  
   @SuppressWarnings("unchecked")
   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
      GetMetricStatistics getRequest = GetMetricStatistics.class.cast(checkNotNull(payload,
               "GetMetricStatistics must be set!"));
      int dimensionIndex = 1;
      int statisticIndex = 1;
      ImmutableMultimap.Builder<String, String> formParameters = ImmutableMultimap.builder();

      for (Dimension dimension : getRequest.getDimensions()) {
         formParameters.put("Dimensions.member." + dimensionIndex + ".Name", dimension.getName());
         formParameters.put("Dimensions.member." + dimensionIndex + ".Value", dimension.getValue());
         dimensionIndex++;
      }

      if (getRequest.getEndTime().isPresent()) {
         formParameters.put("EndTime", dateService.iso8601SecondsDateFormat(getRequest.getEndTime().get()));
      }
      formParameters.put("MetricName", getRequest.getMetricName());
      formParameters.put("Namespace", getRequest.getNamespace());
      formParameters.put("Period", Integer.toString(getRequest.getPeriod()));
      if (getRequest.getStartTime().isPresent()) {
         formParameters.put("StartTime", dateService.iso8601SecondsDateFormat(getRequest
                  .getStartTime().get()));
      }
     
      for (Statistics statistic : getRequest.getStatistics()) {
         formParameters.put("Statistics.member." + statisticIndex, statistic.toString());
         statisticIndex++;
      }

      if (getRequest.getUnit().isPresent()) {
         formParameters.put("Unit", getRequest.getUnit().get().toString());
      }

      return (R) request.toBuilder().replaceFormParams(formParameters.build()).build();
   }
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

      IterableWithMarker<Metric> lmr = api().list(lmo);
      Date endTime = new Date(metricTimestampInCloudWatch.getTime() + (60 * 1000)); // Pad a minute just in case
      Date startTime = new Date(metricTimestampInCloudWatch.getTime() - (60 * 1000)); // Pad a minute just in case

      for (Metric m : lmr) {
         GetMetricStatistics gms = GetMetricStatistics.builder()
                                                      .dimensions(m.getDimensions())
                                                      .namespace(namespace)
                                                      .metricName(m.getMetricName())
                                                      .endTime(endTime)
                                                      .statistic(Statistics.MAXIMUM)
View Full Code Here

Examples of org.jclouds.cloudwatch.domain.GetMetricStatistics

               Date endTime = new Date();
               Calendar cal = Calendar.getInstance();

               cal.add(Calendar.MINUTE, -60 * 24); // 24 hours

               GetMetricStatistics options =
                     GetMetricStatistics.builder()
                                                 .dimension(dimension)
                                                 .endTime(endTime)
                                                 .metricName(metric.getMetricName())
                                                 .namespace(metric.getNamespace())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.