2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
22 * Copyright (C) 2018 Bell Canada. All rights reserved.
24 * Licensed under the Apache License, Version 2.0 (the "License");
25 * you may not use this file except in compliance with the License.
26 * You may obtain a copy of the License at
28 * http://www.apache.org/licenses/LICENSE-2.0
30 * Unless required by applicable law or agreed to in writing, software
31 * distributed under the License is distributed on an "AS IS" BASIS,
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 * See the License for the specific language governing permissions and
34 * limitations under the License.
37 package org.onap.so.heatbridge.openstack.api;
39 import org.openstack4j.model.common.Identifier;
42 * Object handling OpenStack API access information.
44 public class OpenstackAccess {
45 private final String baseUrl;
46 private final String tenantId;
47 private final String user;
48 private final String password;
49 private final String region;
50 private String domainName;
51 private String projectName;
53 public OpenstackAccess(OpenstackAccessBuilder builder) {
54 this.baseUrl = builder.baseUrl;
55 this.tenantId = builder.tenantId;
56 this.user = builder.user;
57 this.password = builder.password;
58 this.region = builder.region;
59 this.domainName = builder.domainName;
60 this.projectName = builder.projectName;
63 public String getUrl() {
67 public String getTenantId() {
71 public String getUser() {
75 public String getPassword() {
79 public String getRegion() {
83 public Identifier getDomainNameIdentifier() {
84 return Identifier.byName(domainName);
87 public String getProjectName() {
91 public static class OpenstackAccessBuilder {
93 private String baseUrl;
94 private String tenantId;
96 private String password;
97 private String region;
98 private String domainName;
99 private String projectName;
101 public OpenstackAccessBuilder setBaseUrl(final String baseUrl) {
102 this.baseUrl = baseUrl;
106 public OpenstackAccessBuilder setTenantId(final String tenantId) {
107 this.tenantId = tenantId;
111 public OpenstackAccessBuilder setUser(final String user) {
116 public OpenstackAccessBuilder setPassword(final String password) {
117 this.password = password;
121 public OpenstackAccessBuilder setRegion(final String region) {
122 this.region = region;
126 public OpenstackAccessBuilder setDomainName(final String domainName) {
127 this.domainName = domainName;
131 public OpenstackAccessBuilder setProjectName(final String projectName) {
132 this.projectName = projectName;
136 public OpenstackAccess build() {
137 return new OpenstackAccess(this);