Add target filter query feign client resource (#410)

* Add TagretFilter Query client resource

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>

* Fix methode signature for feign

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
Dennis Melzer
2017-01-26 15:01:42 +01:00
committed by Kai Zimmermann
parent 5514658f93
commit a00ea49e47
4 changed files with 78 additions and 4 deletions

View File

@@ -0,0 +1,19 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.mgmt.client.resource;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetFilterQueryRestApi;
import org.springframework.cloud.netflix.feign.FeignClient;
/**
* Client binding for the Target filter query resource of the management API.
*/
@FeignClient(name = "MgmtTargetFilterQueryClient", url = "${hawkbit.url:localhost:8080}")
public interface MgmtTargetFilterQueryClientResource extends MgmtTargetFilterQueryRestApi {
}

View File

@@ -0,0 +1,55 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.mgmt.client.resource.builder;
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQueryRequestBody;
/**
* Builder pattern for building {@link MgmtTargetFilterQueryRequestBody}.
*/
// Exception squid:S1701 - builder pattern
@SuppressWarnings({ "squid:S1701" })
public class TargetFilterQueryBuilder {
private String name;
private String query;
/**
* @param name
* the name of the filter
* @return the builder itself
*/
public TargetFilterQueryBuilder name(final String name) {
this.name = name;
return this;
}
/**
* @param query
* the query filter
* @return the builder itself
*/
public TargetFilterQueryBuilder query(final String query) {
this.query = query;
return this;
}
/**
* Builds a single entry of {@link MgmtTargetFilterQueryRequestBody} which
* can directly be used to post on the RESTful-API.
*
* @return a single entry of {@link MgmtTargetFilterQueryRequestBody}
*/
public MgmtTargetFilterQueryRequestBody build() {
final MgmtTargetFilterQueryRequestBody body = new MgmtTargetFilterQueryRequestBody();
body.setName(name);
body.setQuery(query);
return body;
}
}