Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | package org.onosproject.openstacknode.api; |
| 17 | |
| 18 | /** |
| 19 | * Representation of keystone authentication information. |
| 20 | */ |
| 21 | public interface OpenstackAuth { |
| 22 | |
| 23 | /** |
| 24 | * Keystone authentication protocol types. |
| 25 | */ |
| 26 | enum Protocol { |
| 27 | HTTP, |
| 28 | HTTPS |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Keystone user perspective. |
| 33 | */ |
| 34 | enum Perspective { |
| 35 | ADMIN, |
| 36 | INTERNAL, |
| 37 | PUBLIC |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Returns the keystone authentication version number. |
| 42 | * |
| 43 | * @return keystone authentication version |
| 44 | */ |
| 45 | String version(); |
| 46 | |
| 47 | /** |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 48 | * Returns the keystone authentication protocol type. |
| 49 | * |
| 50 | * @return keystone authentication protocol type |
| 51 | */ |
| 52 | Protocol protocol(); |
| 53 | |
| 54 | /** |
| 55 | * Returns the keystone username. |
| 56 | * |
| 57 | * @return keystone username |
| 58 | */ |
| 59 | String username(); |
| 60 | |
| 61 | /** |
| 62 | * Returns the keystone user password. |
| 63 | * |
| 64 | * @return keystone password |
| 65 | */ |
| 66 | String password(); |
| 67 | |
| 68 | /** |
| 69 | * Returns the project name. |
| 70 | * |
| 71 | * @return project name |
| 72 | */ |
| 73 | String project(); |
| 74 | |
| 75 | /** |
| 76 | * Returns the user perspective. |
| 77 | * |
| 78 | * @return user perspective |
| 79 | */ |
| 80 | Perspective perspective(); |
| 81 | |
| 82 | /** |
| 83 | * Builder of keystone authentication info. |
| 84 | */ |
| 85 | interface Builder { |
| 86 | |
| 87 | /** |
| 88 | * Builds an immutable openstack keystone authentication instance. |
| 89 | * |
| 90 | * @return keystone authentication instance |
| 91 | */ |
| 92 | OpenstackAuth build(); |
| 93 | |
| 94 | /** |
| 95 | * Returns keystone authentication builder with supplied version number. |
| 96 | * |
| 97 | * @param version version number |
| 98 | * @return keystone authentication builder |
| 99 | */ |
| 100 | Builder version(String version); |
| 101 | |
| 102 | /** |
Jian Li | 2784166 | 2018-04-14 01:59:47 +0900 | [diff] [blame] | 103 | * Returns keystone authentication builder with supplied protocol. |
| 104 | * |
| 105 | * @param protocol protocol |
| 106 | * @return keystone authentication builder |
| 107 | */ |
| 108 | Builder protocol(Protocol protocol); |
| 109 | |
| 110 | /** |
| 111 | * Returns keystone authentication builder with supplied username. |
| 112 | * |
| 113 | * @param username username |
| 114 | * @return keystone authentication builder |
| 115 | */ |
| 116 | Builder username(String username); |
| 117 | |
| 118 | /** |
| 119 | * Returns keystone authentication builder with supplied password. |
| 120 | * |
| 121 | * @param password password |
| 122 | * @return keystone authentication builder |
| 123 | */ |
| 124 | Builder password(String password); |
| 125 | |
| 126 | /** |
| 127 | * Returns keystone authentication builder with supplied project. |
| 128 | * |
| 129 | * @param project project name |
| 130 | * @return keystone authentication builder |
| 131 | */ |
| 132 | Builder project(String project); |
| 133 | |
| 134 | /** |
| 135 | * Returns keystone authentication builder with supplied perspective. |
| 136 | * |
| 137 | * @param perspective perspective |
| 138 | * @return keystone authentication builder |
| 139 | */ |
| 140 | Builder perspective(Perspective perspective); |
| 141 | |
| 142 | } |
| 143 | } |