olp-cpp-sdk  1.22.0
UpdateIndexRequest.h
1 /*
2  * Copyright (C) 2019-2023 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 #include <utility>
25 #include <vector>
26 
27 #include <boost/optional.hpp>
28 
29 #include <olp/dataservice/write/DataServiceWriteApi.h>
30 #include <olp/dataservice/write/generated/model/Index.h>
31 
32 namespace olp {
33 namespace dataservice {
34 namespace write {
35 namespace model {
37 class DATASERVICE_WRITE_API UpdateIndexRequest {
38  public:
39  UpdateIndexRequest() = default;
40  UpdateIndexRequest(const UpdateIndexRequest&) = default;
42  UpdateIndexRequest& operator=(const UpdateIndexRequest&) = default;
43  UpdateIndexRequest& operator=(UpdateIndexRequest&&) = default;
44  virtual ~UpdateIndexRequest() = default;
50  inline const std::string& GetLayerId() const { return layer_id_; }
51 
59  inline UpdateIndexRequest& WithLayerId(const std::string& layer_id) {
60  layer_id_ = layer_id;
61  return *this;
62  }
63 
71  inline UpdateIndexRequest& WithLayerId(std::string&& layer_id) {
72  layer_id_ = std::move(layer_id);
73  return *this;
74  }
75 
86  inline const boost::optional<std::string>& GetBillingTag() const {
87  return billing_tag_;
88  }
89 
97  inline UpdateIndexRequest& WithBillingTag(const std::string& billing_tag) {
98  billing_tag_ = billing_tag;
99  return *this;
100  }
101 
110  inline UpdateIndexRequest& WithBillingTag(std::string&& billing_tag) {
111  billing_tag_ = std::move(billing_tag);
112  return *this;
113  }
114 
126  inline const boost::optional<std::string>& GetChecksum() const {
127  return checksum_;
128  }
129 
137  inline UpdateIndexRequest& WithChecksum(const std::string& checksum) {
138  checksum_ = checksum;
139  return *this;
140  }
141 
149  inline UpdateIndexRequest& WithChecksum(std::string&& checksum) {
150  checksum_ = std::move(checksum);
151  return *this;
152  }
153 
159  inline const std::vector<Index>& GetIndexAdditions() const {
160  return indexAdditions_;
161  }
162 
169  const std::vector<Index>& indexAdditions) {
170  indexAdditions_ = indexAdditions;
171  return *this;
172  }
173 
181  std::vector<Index>&& indexAdditions) {
182  indexAdditions_ = std::move(indexAdditions);
183  return *this;
184  }
185 
192  inline const std::vector<std::string>& GetIndexRemovals() const {
193  return indexRemovals_;
194  }
195 
204  const std::vector<std::string>& indexRemovals) {
205  indexRemovals_ = indexRemovals;
206  return *this;
207  }
208 
217  std::vector<std::string>&& indexRemovals) {
218  indexRemovals_ = std::move(indexRemovals);
219  return *this;
220  }
221 
222  private:
223  std::string layer_id_;
224 
225  boost::optional<std::string> billing_tag_;
226 
227  boost::optional<std::string> checksum_;
228 
229  std::vector<Index> indexAdditions_;
230 
231  std::vector<std::string> indexRemovals_;
232 };
233 
234 } // namespace model
235 } // namespace write
236 } // namespace dataservice
237 } // namespace olp
Updates an index in an index layer.
Definition: UpdateIndexRequest.h:37
UpdateIndexRequest & WithIndexAdditions(const std::vector< Index > &indexAdditions)
Sets the indexes to be added anew to the index layer.
Definition: UpdateIndexRequest.h:168
UpdateIndexRequest & WithChecksum(std::string &&checksum)
Sets the request checksum.
Definition: UpdateIndexRequest.h:149
UpdateIndexRequest & WithLayerId(std::string &&layer_id)
Sets the layer ID of the catalog where you want to store the data.
Definition: UpdateIndexRequest.h:71
UpdateIndexRequest & WithBillingTag(const std::string &billing_tag)
Sets the billing tag for the request.
Definition: UpdateIndexRequest.h:97
const boost::optional< std::string > & GetChecksum() const
Gets the request checksum.
Definition: UpdateIndexRequest.h:126
UpdateIndexRequest & WithChecksum(const std::string &checksum)
Sets the request checksum.
Definition: UpdateIndexRequest.h:137
const std::string & GetLayerId() const
Gets the layer ID of the catalog where you want to store the data.
Definition: UpdateIndexRequest.h:50
UpdateIndexRequest & WithIndexAdditions(std::vector< Index > &&indexAdditions)
Sets the indexes to be added anew to the index layer.
Definition: UpdateIndexRequest.h:180
UpdateIndexRequest & WithIndexRemovals(const std::vector< std::string > &indexRemovals)
Sets the data handles of the indexes that you want to remove from the index layer.
Definition: UpdateIndexRequest.h:203
const std::vector< std::string > & GetIndexRemovals() const
Gets the data handles of the indexes that you want to remove from the index layer.
Definition: UpdateIndexRequest.h:192
UpdateIndexRequest & WithLayerId(const std::string &layer_id)
Sets the layer ID of the catalog where you want to store the data.
Definition: UpdateIndexRequest.h:59
UpdateIndexRequest & WithBillingTag(std::string &&billing_tag)
Sets the billing tag for the request.
Definition: UpdateIndexRequest.h:110
const boost::optional< std::string > & GetBillingTag() const
Gets the billing tag to group billing records together.
Definition: UpdateIndexRequest.h:86
UpdateIndexRequest & WithIndexRemovals(std::vector< std::string > &&indexRemovals)
Sets the data handles of the indexes that you want to remove from the index layer.
Definition: UpdateIndexRequest.h:216
const std::vector< Index > & GetIndexAdditions() const
Gets the indexes to be added anew to the index layer.
Definition: UpdateIndexRequest.h:159
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24