|
| 1 | +/* |
| 2 | + * Licensed to Elasticsearch B.V. under one or more contributor |
| 3 | + * license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright |
| 5 | + * ownership. Elasticsearch B.V. licenses this file to you under |
| 6 | + * the Apache License, Version 2.0 (the "License"); you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package co.elastic.clients.elasticsearch.connector; |
| 21 | + |
| 22 | +import co.elastic.clients.elasticsearch._types.ErrorResponse; |
| 23 | +import co.elastic.clients.elasticsearch._types.RequestBase; |
| 24 | +import co.elastic.clients.json.JsonpDeserializable; |
| 25 | +import co.elastic.clients.json.JsonpDeserializer; |
| 26 | +import co.elastic.clients.json.ObjectBuilderDeserializer; |
| 27 | +import co.elastic.clients.json.ObjectDeserializer; |
| 28 | +import co.elastic.clients.transport.Endpoint; |
| 29 | +import co.elastic.clients.transport.endpoints.SimpleEndpoint; |
| 30 | +import co.elastic.clients.util.ApiTypeHelper; |
| 31 | +import co.elastic.clients.util.ObjectBuilder; |
| 32 | +import jakarta.json.stream.JsonGenerator; |
| 33 | +import java.lang.String; |
| 34 | +import java.util.Collections; |
| 35 | +import java.util.HashMap; |
| 36 | +import java.util.Map; |
| 37 | +import java.util.Objects; |
| 38 | +import java.util.function.Function; |
| 39 | +import javax.annotation.Nullable; |
| 40 | + |
| 41 | +//---------------------------------------------------------------- |
| 42 | +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. |
| 43 | +//---------------------------------------------------------------- |
| 44 | +// |
| 45 | +// This code is generated from the Elasticsearch API specification |
| 46 | +// at https://github.com/elastic/elasticsearch-specification |
| 47 | +// |
| 48 | +// Manual updates to this file will be lost when the code is |
| 49 | +// re-generated. |
| 50 | +// |
| 51 | +// If you find a property that is missing or wrongly typed, please |
| 52 | +// open an issue or a PR on the API specification repository. |
| 53 | +// |
| 54 | +//---------------------------------------------------------------- |
| 55 | + |
| 56 | +// typedef: connector.check_in.Request |
| 57 | + |
| 58 | +/** |
| 59 | + * Updates the last_seen field in the connector, and sets it to current |
| 60 | + * timestamp |
| 61 | + * |
| 62 | + * @see <a href="../doc-files/api-spec.html#connector.check_in.Request">API |
| 63 | + * specification</a> |
| 64 | + */ |
| 65 | + |
| 66 | +public class CheckInRequest extends RequestBase { |
| 67 | + private final String connectorId; |
| 68 | + |
| 69 | + // --------------------------------------------------------------------------------------------- |
| 70 | + |
| 71 | + private CheckInRequest(Builder builder) { |
| 72 | + |
| 73 | + this.connectorId = ApiTypeHelper.requireNonNull(builder.connectorId, this, "connectorId"); |
| 74 | + |
| 75 | + } |
| 76 | + |
| 77 | + public static CheckInRequest of(Function<Builder, ObjectBuilder<CheckInRequest>> fn) { |
| 78 | + return fn.apply(new Builder()).build(); |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * Required - The unique identifier of the connector to be checked in |
| 83 | + * <p> |
| 84 | + * API name: {@code connector_id} |
| 85 | + */ |
| 86 | + public final String connectorId() { |
| 87 | + return this.connectorId; |
| 88 | + } |
| 89 | + |
| 90 | + // --------------------------------------------------------------------------------------------- |
| 91 | + |
| 92 | + /** |
| 93 | + * Builder for {@link CheckInRequest}. |
| 94 | + */ |
| 95 | + |
| 96 | + public static class Builder extends RequestBase.AbstractBuilder<Builder> implements ObjectBuilder<CheckInRequest> { |
| 97 | + private String connectorId; |
| 98 | + |
| 99 | + /** |
| 100 | + * Required - The unique identifier of the connector to be checked in |
| 101 | + * <p> |
| 102 | + * API name: {@code connector_id} |
| 103 | + */ |
| 104 | + public final Builder connectorId(String value) { |
| 105 | + this.connectorId = value; |
| 106 | + return this; |
| 107 | + } |
| 108 | + |
| 109 | + @Override |
| 110 | + protected Builder self() { |
| 111 | + return this; |
| 112 | + } |
| 113 | + |
| 114 | + /** |
| 115 | + * Builds a {@link CheckInRequest}. |
| 116 | + * |
| 117 | + * @throws NullPointerException |
| 118 | + * if some of the required fields are null. |
| 119 | + */ |
| 120 | + public CheckInRequest build() { |
| 121 | + _checkSingleUse(); |
| 122 | + |
| 123 | + return new CheckInRequest(this); |
| 124 | + } |
| 125 | + } |
| 126 | + |
| 127 | + // --------------------------------------------------------------------------------------------- |
| 128 | + |
| 129 | + /** |
| 130 | + * Endpoint "{@code connector.check_in}". |
| 131 | + */ |
| 132 | + public static final Endpoint<CheckInRequest, CheckInResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>( |
| 133 | + "es/connector.check_in", |
| 134 | + |
| 135 | + // Request method |
| 136 | + request -> { |
| 137 | + return "PUT"; |
| 138 | + |
| 139 | + }, |
| 140 | + |
| 141 | + // Request path |
| 142 | + request -> { |
| 143 | + final int _connectorId = 1 << 0; |
| 144 | + |
| 145 | + int propsSet = 0; |
| 146 | + |
| 147 | + propsSet |= _connectorId; |
| 148 | + |
| 149 | + if (propsSet == (_connectorId)) { |
| 150 | + StringBuilder buf = new StringBuilder(); |
| 151 | + buf.append("/_connector"); |
| 152 | + buf.append("/"); |
| 153 | + SimpleEndpoint.pathEncode(request.connectorId, buf); |
| 154 | + buf.append("/_check_in"); |
| 155 | + return buf.toString(); |
| 156 | + } |
| 157 | + throw SimpleEndpoint.noPathTemplateFound("path"); |
| 158 | + |
| 159 | + }, |
| 160 | + |
| 161 | + // Path parameters |
| 162 | + request -> { |
| 163 | + Map<String, String> params = new HashMap<>(); |
| 164 | + final int _connectorId = 1 << 0; |
| 165 | + |
| 166 | + int propsSet = 0; |
| 167 | + |
| 168 | + propsSet |= _connectorId; |
| 169 | + |
| 170 | + if (propsSet == (_connectorId)) { |
| 171 | + params.put("connectorId", request.connectorId); |
| 172 | + } |
| 173 | + return params; |
| 174 | + }, |
| 175 | + |
| 176 | + // Request parameters |
| 177 | + request -> { |
| 178 | + return Collections.emptyMap(); |
| 179 | + |
| 180 | + }, SimpleEndpoint.emptyMap(), false, CheckInResponse._DESERIALIZER); |
| 181 | +} |
0 commit comments