Search in sources :

Example 1 with AutoScaleClusterV1Endpoint

use of com.sequenceiq.periscope.api.endpoint.v1.AutoScaleClusterV1Endpoint in project cloudbreak by hortonworks.

the class AutoscalingUtil method getPeriscopeClusterId.

static long getPeriscopeClusterId(AutoscaleClient autoscaleClient, String stackId) {
    Long clusterId = null;
    int retryCount = 0;
    AutoScaleClusterV1Endpoint autoScaleClusterV1Endpoint = autoscaleClient.clusterEndpoint();
    while (clusterId == null && retryCount < 30) {
        LOGGER.info("Waiting for having Prometheus cluster id ...");
        CloudbreakUtil.sleep();
        List<AutoscaleClusterResponse> autoscaleClusterResponse = autoScaleClusterV1Endpoint.getClusters();
        for (AutoscaleClusterResponse elem : autoscaleClusterResponse) {
            if (String.valueOf(elem.getStackId()).equals(stackId)) {
                clusterId = elem.getId();
            }
        }
        retryCount += 1;
    }
    Assert.assertNotNull(clusterId);
    return clusterId;
}
Also used : AutoscaleClusterResponse(com.sequenceiq.periscope.api.model.AutoscaleClusterResponse) AutoScaleClusterV1Endpoint(com.sequenceiq.periscope.api.endpoint.v1.AutoScaleClusterV1Endpoint) StackV1Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint) ConfigurationEndpoint(com.sequenceiq.periscope.api.endpoint.v1.ConfigurationEndpoint) AlertEndpoint(com.sequenceiq.periscope.api.endpoint.v1.AlertEndpoint) PolicyEndpoint(com.sequenceiq.periscope.api.endpoint.v1.PolicyEndpoint) AutoScaleClusterV1Endpoint(com.sequenceiq.periscope.api.endpoint.v1.AutoScaleClusterV1Endpoint)

Example 2 with AutoScaleClusterV1Endpoint

use of com.sequenceiq.periscope.api.endpoint.v1.AutoScaleClusterV1Endpoint in project cloudbreak by hortonworks.

the class AutoscalingUtil method switchAutoscaling.

static void switchAutoscaling(AutoscaleClient autoscaleClient, Long clusterId, boolean enableAutoscaling) {
    AutoScaleClusterV1Endpoint autoScaleClusterV1Endpoint = autoscaleClient.clusterEndpoint();
    AutoscaleClusterState json = new AutoscaleClusterState();
    json.setEnableAutoscaling(enableAutoscaling);
    autoScaleClusterV1Endpoint.setAutoscaleState(clusterId, json);
}
Also used : AutoscaleClusterState(com.sequenceiq.periscope.api.model.AutoscaleClusterState) AutoScaleClusterV1Endpoint(com.sequenceiq.periscope.api.endpoint.v1.AutoScaleClusterV1Endpoint)

Aggregations

AutoScaleClusterV1Endpoint (com.sequenceiq.periscope.api.endpoint.v1.AutoScaleClusterV1Endpoint)2 StackV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint)1 AlertEndpoint (com.sequenceiq.periscope.api.endpoint.v1.AlertEndpoint)1 ConfigurationEndpoint (com.sequenceiq.periscope.api.endpoint.v1.ConfigurationEndpoint)1 PolicyEndpoint (com.sequenceiq.periscope.api.endpoint.v1.PolicyEndpoint)1 AutoscaleClusterResponse (com.sequenceiq.periscope.api.model.AutoscaleClusterResponse)1 AutoscaleClusterState (com.sequenceiq.periscope.api.model.AutoscaleClusterState)1