Add Managment Default Feign Client
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetTagClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetTypeClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDownloadArtifactClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDownloadClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtRolloutClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleTypeClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetTagClientResource;
|
||||
import org.springframework.cloud.netflix.feign.support.ResponseEntityDecoder;
|
||||
|
||||
import feign.Feign;
|
||||
import feign.Feign.Builder;
|
||||
import feign.Logger;
|
||||
import feign.Logger.Level;
|
||||
import feign.jackson.JacksonDecoder;
|
||||
import feign.jackson.JacksonEncoder;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class MgmtDefaultFeignClient {
|
||||
|
||||
private MgmtDistributionSetClientResource mgmtDistributionSetClientResource;
|
||||
private MgmtDistributionSetTagClientResource mgmtDistributionSetTagClientResource;
|
||||
private MgmtDistributionSetTypeClientResource mgmtDistributionSetTypeClientResource;
|
||||
private MgmtRolloutClientResource mgmtRolloutClientResource;
|
||||
private MgmtSoftwareModuleClientResource mgmtSoftwareModuleClientResource;
|
||||
private MgmtSoftwareModuleTypeClientResource mgmtSoftwareModuleTypeClientResource;
|
||||
private MgmtTargetClientResource mgmtTargetClientResource;
|
||||
private MgmtTargetTagClientResource mgmtTargetTagClientResource;
|
||||
private MgmtDownloadClientResource mgmtDownloadClientResource;
|
||||
private MgmtDownloadArtifactClientResource mgmtDownloadArtifactClientResource;
|
||||
|
||||
private final Builder feignBuilder;
|
||||
private final String baseUrl;
|
||||
|
||||
public MgmtDefaultFeignClient(final String baseUrl) {
|
||||
feignBuilder = Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract())
|
||||
.requestInterceptor(new ApplicationJsonRequestHeaderInterceptor()).logLevel(Level.FULL)
|
||||
.logger(new Logger.ErrorLogger()).encoder(new JacksonEncoder())
|
||||
.decoder(new ResponseEntityDecoder(new JacksonDecoder()));
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public Builder getFeignBuilder() {
|
||||
return feignBuilder;
|
||||
}
|
||||
|
||||
public MgmtDistributionSetClientResource getMgmtDistributionSetClientResource() {
|
||||
if (mgmtDistributionSetClientResource == null) {
|
||||
mgmtDistributionSetClientResource = feignBuilder.target(MgmtDistributionSetClientResource.class,
|
||||
this.baseUrl + MgmtDistributionSetClientResource.PATH);
|
||||
}
|
||||
return mgmtDistributionSetClientResource;
|
||||
}
|
||||
|
||||
public MgmtDistributionSetTagClientResource getMgmtDistributionSetTagClientResource() {
|
||||
if (mgmtDistributionSetTagClientResource == null) {
|
||||
mgmtDistributionSetTagClientResource = feignBuilder.target(MgmtDistributionSetTagClientResource.class,
|
||||
this.baseUrl + MgmtDistributionSetTagClientResource.PATH);
|
||||
}
|
||||
return mgmtDistributionSetTagClientResource;
|
||||
}
|
||||
|
||||
public MgmtDistributionSetTypeClientResource getMgmtDistributionSetTypeClientResource() {
|
||||
if (mgmtDistributionSetTypeClientResource == null) {
|
||||
mgmtDistributionSetTypeClientResource = feignBuilder.target(MgmtDistributionSetTypeClientResource.class,
|
||||
this.baseUrl + MgmtDistributionSetTypeClientResource.PATH);
|
||||
}
|
||||
return mgmtDistributionSetTypeClientResource;
|
||||
}
|
||||
|
||||
public MgmtRolloutClientResource getMgmtRolloutClientResource() {
|
||||
if (mgmtRolloutClientResource == null) {
|
||||
mgmtRolloutClientResource = feignBuilder.target(MgmtRolloutClientResource.class,
|
||||
this.baseUrl + MgmtRolloutClientResource.PATH);
|
||||
}
|
||||
return mgmtRolloutClientResource;
|
||||
}
|
||||
|
||||
public MgmtSoftwareModuleClientResource getMgmtSoftwareModuleClientResource() {
|
||||
if (mgmtSoftwareModuleClientResource == null) {
|
||||
mgmtSoftwareModuleClientResource = feignBuilder.target(MgmtSoftwareModuleClientResource.class,
|
||||
MgmtSoftwareModuleClientResource.PATH);
|
||||
}
|
||||
return mgmtSoftwareModuleClientResource;
|
||||
}
|
||||
|
||||
public MgmtSoftwareModuleTypeClientResource getMgmtSoftwareModuleTypeClientResource() {
|
||||
if (mgmtSoftwareModuleTypeClientResource == null) {
|
||||
mgmtSoftwareModuleTypeClientResource = feignBuilder.target(MgmtSoftwareModuleTypeClientResource.class,
|
||||
this.baseUrl + MgmtSoftwareModuleTypeClientResource.PATH);
|
||||
}
|
||||
return mgmtSoftwareModuleTypeClientResource;
|
||||
}
|
||||
|
||||
public MgmtTargetClientResource getMgmtTargetClientResource() {
|
||||
if (mgmtTargetClientResource == null) {
|
||||
mgmtTargetClientResource = feignBuilder.target(MgmtTargetClientResource.class,
|
||||
this.baseUrl + MgmtTargetClientResource.PATH);
|
||||
}
|
||||
return mgmtTargetClientResource;
|
||||
}
|
||||
|
||||
public MgmtTargetTagClientResource getMgmtTargetTagClientResource() {
|
||||
if (mgmtTargetTagClientResource == null) {
|
||||
mgmtTargetTagClientResource = feignBuilder.target(MgmtTargetTagClientResource.class,
|
||||
this.baseUrl + MgmtTargetTagClientResource.PATH);
|
||||
}
|
||||
return mgmtTargetTagClientResource;
|
||||
}
|
||||
|
||||
public MgmtDownloadClientResource getMgmtDownloadClientResource() {
|
||||
if (mgmtDownloadClientResource == null) {
|
||||
mgmtDownloadClientResource = feignBuilder.target(MgmtDownloadClientResource.class,
|
||||
this.baseUrl + MgmtDownloadClientResource.PATH);
|
||||
}
|
||||
return mgmtDownloadClientResource;
|
||||
}
|
||||
|
||||
public MgmtDownloadArtifactClientResource getMgmtDownloadArtifactClientResource() {
|
||||
if (mgmtDownloadArtifactClientResource == null) {
|
||||
mgmtDownloadArtifactClientResource = feignBuilder.target(MgmtDownloadArtifactClientResource.class,
|
||||
this.baseUrl + MgmtDownloadArtifactClientResource.PATH);
|
||||
}
|
||||
return mgmtDownloadArtifactClientResource;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the DistributionSet resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/distributionsets")
|
||||
public interface DistributionSetResourceClient extends MgmtDistributionSetRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtDistributionSetClientResource.PATH)
|
||||
public interface MgmtDistributionSetClientResource extends MgmtDistributionSetRestApi {
|
||||
|
||||
static String PATH = "rest/v1/distributionsets";
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the DistributionSetTag resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/distributionsettags")
|
||||
public interface DistributionSetTagResourceClient extends MgmtDistributionSetTagRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtDistributionSetTagClientResource.PATH)
|
||||
public interface MgmtDistributionSetTagClientResource extends MgmtDistributionSetTagRestApi {
|
||||
|
||||
static String PATH = "rest/v1/distributionsettags";
|
||||
}
|
||||
@@ -15,7 +15,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
* Client binding for the DistributionSetType resource of the management API.
|
||||
*
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/distributionsettypes")
|
||||
public interface DistributionSetTypeResourceClient extends MgmtDistributionSetTypeRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtDistributionSetTypeClientResource.PATH)
|
||||
public interface MgmtDistributionSetTypeClientResource extends MgmtDistributionSetTypeRestApi {
|
||||
|
||||
static String PATH = "rest/v1/distributionsettypes";
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.MgmtDownloadArtifactRestApi;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtDownloadArtifactClientResource.PATH)
|
||||
public interface MgmtDownloadArtifactClientResource extends MgmtDownloadArtifactRestApi {
|
||||
|
||||
static String PATH = "rest/v1/softwaremodules";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.MgmtDownloadRestApi;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtDownloadClientResource.PATH)
|
||||
public interface MgmtDownloadClientResource extends MgmtDownloadRestApi {
|
||||
|
||||
static String PATH = "api/v1/downloadserver/";
|
||||
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the Rollout resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/rollouts")
|
||||
public interface RolloutResourceClient extends MgmtRolloutRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtRolloutClientResource.PATH)
|
||||
public interface MgmtRolloutClientResource extends MgmtRolloutRestApi {
|
||||
|
||||
static String PATH = "rest/v1/rollouts";
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the SoftwareModule resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/softwaremodules")
|
||||
public interface SoftwareModuleResourceClient extends MgmtSoftwareModuleRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtSoftwareModuleClientResource.PATH)
|
||||
public interface MgmtSoftwareModuleClientResource extends MgmtSoftwareModuleRestApi {
|
||||
|
||||
static String PATH = "rest/v1/softwaremodules";
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the oftwareModuleType resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/softwaremoduletypes")
|
||||
public interface SoftwareModuleTypeResourceClient extends MgmtSoftwareModuleTypeRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtSoftwareModuleTypeClientResource.PATH)
|
||||
public interface MgmtSoftwareModuleTypeClientResource extends MgmtSoftwareModuleTypeRestApi {
|
||||
|
||||
static String PATH = "rest/v1/softwaremoduletypes";
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the Target resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/targets")
|
||||
public interface TargetResourceClient extends MgmtTargetRestApi {
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtTargetClientResource.PATH)
|
||||
public interface MgmtTargetClientResource extends MgmtTargetRestApi {
|
||||
|
||||
static String PATH = "/rest/v1/targets";
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
/**
|
||||
* Client binding for the TargetTag resource of the management API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/targettags")
|
||||
public interface TargetTagResourceClient extends MgmtTargetTagRestApi {
|
||||
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtTargetTagClientResource.PATH)
|
||||
public interface MgmtTargetTagClientResource extends MgmtTargetTagRestApi {
|
||||
static String PATH = "rest/v1/targettags";
|
||||
}
|
||||
@@ -10,12 +10,12 @@ package org.eclipse.hawkbit.mgmt.client.scenarios;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.RolloutResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleTypeResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.TargetResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetTypeClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtRolloutClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleTypeClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.builder.DistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.builder.DistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.builder.RolloutBuilder;
|
||||
@@ -44,22 +44,22 @@ public class CreateStartedRolloutExample {
|
||||
private static final String DS_MODULE_TYPE = SM_MODULE_TYPE;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetResourceClient distributionSetResource;
|
||||
private MgmtDistributionSetClientResource distributionSetResource;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleResourceClient softwareModuleResource;
|
||||
private MgmtSoftwareModuleClientResource softwareModuleResource;
|
||||
|
||||
@Autowired
|
||||
private TargetResourceClient targetResource;
|
||||
private MgmtTargetClientResource targetResource;
|
||||
|
||||
@Autowired
|
||||
private RolloutResourceClient rolloutResource;
|
||||
private MgmtRolloutClientResource rolloutResource;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetTypeResourceClient distributionSetTypeResource;
|
||||
private MgmtDistributionSetTypeClientResource distributionSetTypeResource;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleTypeResourceClient softwareModuleTypeResource;
|
||||
private MgmtSoftwareModuleTypeClientResource softwareModuleTypeResource;
|
||||
|
||||
/**
|
||||
* Run the Rollout scenario.
|
||||
|
||||
@@ -10,10 +10,10 @@ package org.eclipse.hawkbit.mgmt.client.scenarios;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleTypeResourceClient;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtDistributionSetTypeClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleTypeClientResource;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.builder.DistributionSetBuilder;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.builder.DistributionSetTypeBuilder;
|
||||
import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleAssigmentBuilder;
|
||||
@@ -50,16 +50,16 @@ public class GettingStartedDefaultScenario {
|
||||
private static final String DS_EXAMPLE_NAME = SM_EXAMPLE_NAME;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetResourceClient distributionSetResource;
|
||||
private MgmtDistributionSetClientResource distributionSetResource;
|
||||
|
||||
@Autowired
|
||||
private DistributionSetTypeResourceClient distributionSetTypeResource;
|
||||
private MgmtDistributionSetTypeClientResource distributionSetTypeResource;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleResourceClient softwareModuleResource;
|
||||
private MgmtSoftwareModuleClientResource softwareModuleResource;
|
||||
|
||||
@Autowired
|
||||
private SoftwareModuleTypeResourceClient softwareModuleTypeResource;
|
||||
private MgmtSoftwareModuleTypeClientResource softwareModuleTypeResource;
|
||||
|
||||
/**
|
||||
* Run the default getting started scenario.
|
||||
|
||||
Reference in New Issue
Block a user