diff options
author | ChrisC <cc697w@intl.att.com> | 2017-01-31 13:57:24 +0100 |
---|---|---|
committer | ChrisC <cc697w@intl.att.com> | 2017-01-31 14:55:11 +0100 |
commit | 2e984294ac28c6f2ede290c38164c5d536ccaf4a (patch) | |
tree | 5eba5a929b7a961c98749fa69e03cfea58e1a724 /heat-client | |
parent | 86c0f28c8ed469486b64d6422dc53e3a7bcc8adb (diff) |
Initial OpenECOMP MSO OpenStack SDK lib commit
Change-Id: Ieaacb2b2c0dcc469669880e73f0cda9fa59a6c5a
Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'heat-client')
4 files changed, 164 insertions, 0 deletions
diff --git a/heat-client/pom.xml b/heat-client/pom.xml new file mode 100644 index 0000000..b94cf80 --- /dev/null +++ b/heat-client/pom.xml @@ -0,0 +1,26 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.openecomp.mso.libs</groupId> + <artifactId>openstack-java-sdk</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <groupId>org.openecomp.mso.libs.openstack-java-sdk</groupId> + <artifactId>heat-client</artifactId> + <name>OpenStack Heat Client</name> + <description>OpenStack Heat Client</description> + <dependencies> + <dependency> + <groupId>org.openecomp.mso.libs.openstack-java-sdk</groupId> + <artifactId>openstack-client</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.openecomp.mso.libs.openstack-java-sdk</groupId> + <artifactId>heat-model</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + </dependencies> + +</project>
\ No newline at end of file diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java new file mode 100644 index 0000000..96e9cd7 --- /dev/null +++ b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java @@ -0,0 +1,31 @@ +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +/** + * Reference: http://api.openstack.org/api-ref-orchestration.html + */ +public class Heat extends OpenStackClient { + + private final StackResource stacks; + private final ResourcesResource resources; + + public Heat(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + stacks = new StackResource(this); + resources = new ResourcesResource(this); + } + + public Heat(String endpoint) { + this(endpoint, null); + } + + public StackResource getStacks() { + return stacks; + } + + public ResourcesResource getResources() { + return resources; + } +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java b/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java new file mode 100644 index 0000000..c3635bc --- /dev/null +++ b/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java @@ -0,0 +1,31 @@ +package com.woorea.openstack.heat; + +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.heat.model.Resources; + + +/** + * v1/{tenant_id}/stacks/{stack_name}/resources + */ +public class ResourcesResource { + private final OpenStackClient client; + + public ResourcesResource(OpenStackClient client) { + this.client = client; + } + + public ListResources listResources(String name) { + return new ListResources(name); + } + + /** + * v1/{tenant_id}/stacks/{stack_name}/resources + */ + public class ListResources extends OpenStackRequest<Resources> { + public ListResources(String name) { + super(client, HttpMethod.GET, "/stacks/" + name + "/resources", null, Resources.class); + } + } +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java b/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java new file mode 100644 index 0000000..055a5c4 --- /dev/null +++ b/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java @@ -0,0 +1,76 @@ +package com.woorea.openstack.heat; + +/* + * Modifications copyright (c) 2017 AT&T Intellectual Property + */ + +import com.woorea.openstack.base.client.Entity; +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.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.UpdateStackParam; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stacks; + +public class StackResource { + + private final OpenStackClient client; + + public StackResource(OpenStackClient client) { + this.client = client; + } + + public CreateStack create(CreateStackParam param) { + return new CreateStack(param); + } + + public UpdateStack update(String name, UpdateStackParam param) { + return new UpdateStack(name, param); + } + + public List list() { + return new List(); + } + + public GetStack byName(String name) { + return new GetStack(name); + } + + public DeleteStack deleteByName(String name) { + return new DeleteStack(name); + } + + public class CreateStack extends OpenStackRequest<Stack> { + public CreateStack(CreateStackParam params) { + super(client, HttpMethod.POST, "/stacks", Entity.json(params), Stack.class); + } + } + + public class UpdateStack extends OpenStackRequest<Void> { + public UpdateStack(String name, UpdateStackParam params) { + super(client, HttpMethod.PUT, "/stacks/" + name, Entity.json(params), Void.class); + } + } + + public class DeleteStack extends OpenStackRequest<Void> { + public DeleteStack(String name) { + super(client, HttpMethod.DELETE, "/stacks/" + name, null, Void.class); + } + } + + + public class GetStack extends OpenStackRequest<Stack> { + public GetStack(String name) { + super(client, HttpMethod.GET, "/stacks/" + name, null, Stack.class); + } + } + + public class List extends OpenStackRequest<Stacks> { + public List() { + super(client, HttpMethod.GET, "/stacks", null, Stacks.class); + } + } + + +} |