diff options
author | Boslet, Cory (cb645j) <cb645j@att.com> | 2020-07-17 14:12:33 -0500 |
---|---|---|
committer | Boslet, Cory (cb645j) <cb645j@att.com> | 2020-07-17 17:26:19 -0500 |
commit | fa72245f9ac26f3dbd155bf4a50594d5250ea25c (patch) | |
tree | a47d1ade9352edb0478f64fbff1d109c918f7b05 /nova-client | |
parent | 4ea22cc961c56de0a8e2bd18932a316810edfa09 (diff) |
Nova client to support getting availability zones and UTs
Issue-ID: SO-3074
Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fb911
Signed-off-by: Boslet, Cory (cb645j) <cb645j@att.com>
Diffstat (limited to 'nova-client')
-rw-r--r-- | nova-client/src/main/java/com/woorea/openstack/nova/Nova.java | 8 | ||||
-rw-r--r-- | nova-client/src/main/java/com/woorea/openstack/nova/api/AvailabilityZoneResource.java | 45 |
2 files changed, 53 insertions, 0 deletions
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java index 908e1e9..4073568 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java @@ -19,6 +19,7 @@ package com.woorea.openstack.nova; import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.nova.api.AvailabilityZoneResource; import com.woorea.openstack.nova.api.ExtensionsResource; import com.woorea.openstack.nova.api.FlavorsResource; import com.woorea.openstack.nova.api.ImagesResource; @@ -61,6 +62,8 @@ public class Nova extends OpenStackClient { private final HypervisorsExtension hypervisor; + private final AvailabilityZoneResource availabilityZones; + public Nova(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); extensions = new ExtensionsResource(this); @@ -76,6 +79,7 @@ public class Nova extends OpenStackClient { quotaSets = new QuotaSetsResource(this); hosts = new HostsExtension(this); hypervisor = new HypervisorsExtension(this); + availabilityZones = new AvailabilityZoneResource(this); } public Nova(String endpoint) { @@ -133,4 +137,8 @@ public class Nova extends OpenStackClient { public HypervisorsExtension hypervisors() { return hypervisor; } + + public AvailabilityZoneResource availabilityZones() { + return availabilityZones; + } } diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/AvailabilityZoneResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/AvailabilityZoneResource.java new file mode 100644 index 0000000..e97839e --- /dev/null +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/AvailabilityZoneResource.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * 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. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.nova.api; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.AvailabilityZones; + +public class AvailabilityZoneResource { + + private final OpenStackClient client; + + public AvailabilityZoneResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(false); + } + + public class List extends OpenStackRequest<AvailabilityZones> { + + public List(boolean detail) { + super(client, HttpMethod.GET, detail ? "/os-availability-zone/detail" : "/os-availability-zone", null, + AvailabilityZones.class); + } + } + +} |