|
| 1 | +/** |
| 2 | + * Copyright 2018, 2019, 2020, 2021 SourceLab.org https://github.com/SourceLabOrg/kafka-connect-client |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
| 5 | + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the |
| 6 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit |
| 7 | + * persons to whom the Software is furnished to do so, subject to the following conditions: |
| 8 | + * |
| 9 | + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
| 10 | + * Software. |
| 11 | + * |
| 12 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 13 | + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 14 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 15 | + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.sourcelab.kafka.connect.apiclient.request.put; |
| 19 | + |
| 20 | +import org.sourcelab.kafka.connect.apiclient.util.UrlEscapingUtil; |
| 21 | + |
| 22 | +import java.io.IOException; |
| 23 | +import java.util.Objects; |
| 24 | + |
| 25 | +/** |
| 26 | + * Defines request to stop a connector. |
| 27 | + */ |
| 28 | +public final class PutConnectorStop implements PutRequest<Boolean> { |
| 29 | + private final String connectorName; |
| 30 | + |
| 31 | + /** |
| 32 | + * Constructor. |
| 33 | + * @param connectorName Name of connector |
| 34 | + */ |
| 35 | + public PutConnectorStop(final String connectorName) { |
| 36 | + Objects.requireNonNull(connectorName); |
| 37 | + this.connectorName = connectorName; |
| 38 | + } |
| 39 | + |
| 40 | + @Override |
| 41 | + public String getApiEndpoint() { |
| 42 | + return "/connectors/" + UrlEscapingUtil.escapePath(connectorName) + "/stop"; |
| 43 | + } |
| 44 | + |
| 45 | + @Override |
| 46 | + public Object getRequestBody() { |
| 47 | + return null; |
| 48 | + } |
| 49 | + |
| 50 | + @Override |
| 51 | + public Boolean parseResponse(final String responseStr) throws IOException { |
| 52 | + return true; |
| 53 | + } |
| 54 | +} |
0 commit comments