2 * Copyright (C) 2018 Bell Canada. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.so.heatbridge.openstack.api;
19 import org.openstack4j.model.common.Identifier;
22 * Object handling OpenStack API access information.
24 public class OpenstackAccess {
25 private final String baseUrl;
26 private final String tenantId;
27 private final String user;
28 private final String password;
29 private final String region;
30 private String domainName;
31 private String projectName;
33 public OpenstackAccess(OpenstackAccessBuilder builder) {
34 this.baseUrl = builder.baseUrl;
35 this.tenantId = builder.tenantId;
36 this.user = builder.user;
37 this.password = builder.password;
38 this.region = builder.region;
39 this.domainName = builder.domainName;
40 this.projectName = builder.projectName;
43 public String getUrl() {
47 public String getTenantId() {
51 public String getUser() {
55 public String getPassword() {
59 public String getRegion() {
63 public Identifier getDomainNameIdentifier() {
64 return Identifier.byName(domainName);
67 public String getProjectName() {
71 public static class OpenstackAccessBuilder {
73 private String baseUrl;
74 private String tenantId;
76 private String password;
77 private String region;
78 private String domainName;
79 private String projectName;
81 public OpenstackAccessBuilder setBaseUrl(final String baseUrl) {
82 this.baseUrl = baseUrl;
86 public OpenstackAccessBuilder setTenantId(final String tenantId) {
87 this.tenantId = tenantId;
91 public OpenstackAccessBuilder setUser(final String user) {
96 public OpenstackAccessBuilder setPassword(final String password) {
97 this.password = password;
101 public OpenstackAccessBuilder setRegion(final String region) {
102 this.region = region;
106 public OpenstackAccessBuilder setDomainName(final String domainName) {
107 this.domainName = domainName;
111 public OpenstackAccessBuilder setProjectName(final String projectName) {
112 this.projectName = projectName;
116 public OpenstackAccess build() {
117 return new OpenstackAccess(this);