
org.xlcloud.openstack.client.Ceilo Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2012 AMG.lab, a Bull Group Company
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xlcloud.openstack.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.xlcloud.openstack.model.ceilometer.Sample;
public class Ceilo {
public static void main(String[] argv) {
OpenStackCeilometerClient client = new OpenStackCeilometerClient();
client.init();
// List samples = client.listSamples("xlc.stack.start");
// System.out.println(samples.size());
// for(Sample sample : samples) {
// System.out.println(sample);
// }
// List resources = client.listResources();
// System.out.println(resources.size());
// System.out.println(resources.get(0).getResource_id());
// System.out.println(resources.get(0).getMetadata());
// Query query = new Query("resource_id",Operator.EQ,"string","stackId");
// Queries queries = new Queries();
// queries.getQ().add(query);
// List meters = client.listMeters();
// System.out.println(meters.size());
// System.out.println(meters.get(0).getName());
// System.out.println(meters.get(0).getType());
List samples = new ArrayList<>();
samples.add(sampleSample());
System.out.println("Let's try");
client.createSamples("xlc.stack.start", samples);
System.out.println("Done!");
}
private static Sample sampleSample() {
Sample sample = new Sample();
sample.setUser_id("userId");
sample.setResource_id("resourceId");
sample.setCounter_unit("None");
sample.setCounter_volume("1");
sample.setProject_id("projectId");
sample.setCounter_type("gauge");
Map metadata = new HashMap<>();
metadata.put("key", "value");
metadata.put("hello", "world");
sample.setResource_metadata(metadata);
return sample;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy