olp-cpp-sdk  1.19.0
HRN.h
1 /*
2  * Copyright (C) 2019-2021 HERE Europe B.V.
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  * SPDX-License-Identifier: Apache-2.0
17  * License-Filename: LICENSE
18  */
19 
20 #pragma once
21 
22 #include <memory>
23 #include <string>
24 
25 #include <olp/core/CoreApi.h>
26 
27 namespace olp {
28 namespace client {
29 
34 class CORE_API HRN {
35  public:
39  enum ServiceType {
41  Data,
43  Pipeline
44  };
45 
55  static HRN FromString(const std::string& input);
56 
66  static std::unique_ptr<HRN> UniqueFromString(const std::string& input);
67 
71  HRN() = default;
72 
80  explicit HRN(const std::string& input);
81 
91  bool operator==(const HRN& rhs) const;
92 
102  bool operator!=(const HRN& rhs) const;
103 
111  explicit operator bool() const;
112 
120  bool IsNull() const;
121 
129  std::string ToString() const;
130 
138  std::string ToCatalogHRNString() const;
139 
148  const std::string& GetPartition() const { return partition_; }
149 
155  ServiceType GetService() const { return service_; }
156 
162  const std::string& GetRegion() const { return region_; }
163 
169  const std::string& GetAccount() const { return account_; }
170 
178  const std::string& GetCatalogId() const { return catalog_id_; }
179 
187  const std::string& GetLayerId() const { return layer_id_; }
188 
194  const std::string& GetGroupId() const { return group_id_; }
195 
201  const std::string& GetSchemaName() const { return schema_name_; }
202 
209  const std::string& GetVersion() const { return version_; }
210 
217  const std::string& GetPipelineId() const { return pipeline_id_; }
218 
219  private:
222  std::string partition_;
223 
225  ServiceType service_{ServiceType::Unknown};
226 
228  std::string region_;
229 
231  std::string account_;
232 
234  std::string catalog_id_;
235 
237  std::string layer_id_;
238 
240  std::string group_id_;
241 
243  std::string schema_name_;
244 
246  std::string version_;
247 
250  std::string pipeline_id_;
251 };
252 
253 } // namespace client
254 } // namespace olp
Allows a Here Resource Name (HRN) to be passed to the operations that require it.
Definition: HRN.h:34
const std::string & GetRegion() const
Returns the region of this HRN.
Definition: HRN.h:162
std::string ToCatalogHRNString() const
Converts this HRN to a string catalog ID.
std::string ToString() const
Converts this HRN to a string.
static HRN FromString(const std::string &input)
Creates the HRN instance from a string.
ServiceType
Defines the objects to which the HRN can refer.
Definition: HRN.h:39
@ Schema
This HRN represents the schema type.
Definition: HRN.h:42
@ Unknown
The service type is unknown.
Definition: HRN.h:40
@ Data
This HRN represents the data catalog.
Definition: HRN.h:41
static std::unique_ptr< HRN > UniqueFromString(const std::string &input)
Creates the unique HRN instance from a string.
const std::string & GetSchemaName() const
Retruns the schema name.
Definition: HRN.h:201
const std::string & GetPipelineId() const
Returns the pipeline ID.
Definition: HRN.h:217
HRN()=default
Default constructor which creates an empty invalid HRN.
ServiceType GetService() const
Returns the service type of this HRN.
Definition: HRN.h:155
const std::string & GetGroupId() const
Returns the group ID.
Definition: HRN.h:194
bool IsNull() const
Checks whether any of the service type fields of the HRN instance are empty.
const std::string & GetPartition() const
Returns the partitions of this HRN.
Definition: HRN.h:148
bool operator!=(const HRN &rhs) const
Checks whether the values of the HRN parameter are not the same as the values of the rhs parameter.
const std::string & GetAccount() const
Returns the account of this HRN.
Definition: HRN.h:169
const std::string & GetVersion() const
Returns the catalog version.
Definition: HRN.h:209
const std::string & GetLayerId() const
Returns the layer ID.
Definition: HRN.h:187
HRN(const std::string &input)
Creates the HRN instance from a string.
bool operator==(const HRN &rhs) const
Checks whether the values of the HRN parameter are the same as the values of the rhs parameter.
const std::string & GetCatalogId() const
Returns the catalog ID.
Definition: HRN.h:178
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24