Merge branch 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public enum CFAppState {
|
|
||||||
|
|
||||||
STOPPED,
|
|
||||||
STARTED,
|
|
||||||
UNKNOWN
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface CFApplication extends CFEntity {
|
|
||||||
//TODO: lots of this infos should be moved to application details
|
|
||||||
|
|
||||||
int getInstances();
|
|
||||||
int getRunningInstances();
|
|
||||||
int getMemory();
|
|
||||||
UUID getGuid();
|
|
||||||
List<String> getServices();
|
|
||||||
String getBuildpackUrl();
|
|
||||||
List<String> getUris();
|
|
||||||
CFAppState getState();
|
|
||||||
int getDiskQuota();
|
|
||||||
Integer getTimeout();
|
|
||||||
String getCommand();
|
|
||||||
String getStack();
|
|
||||||
|
|
||||||
Map<String,String> getEnvAsMap();
|
|
||||||
String getHealthCheckType();
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public interface CFApplicationArchive {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CFApplicationDetail extends CFApplication {
|
|
||||||
List<CFInstanceStats> getInstanceDetails();
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public interface CFCloudDomain {
|
|
||||||
String getName();
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public enum CFInstanceState {
|
|
||||||
RUNNING, CRASHED, FLAPPING, STARTING, DOWN, UNKNOWN
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public interface CFInstanceStats {
|
|
||||||
|
|
||||||
CFInstanceState getState();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface CFOrganization extends CFEntity {
|
|
||||||
UUID getGuid();
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface CFSpace extends CFEntity {
|
|
||||||
CFOrganization getOrganization();
|
|
||||||
UUID getGuid();
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public interface CFStack extends CFEntity {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,57 +17,4 @@ public interface ClientRequests {
|
|||||||
|
|
||||||
List<CFBuildpack> getBuildpacks() throws Exception;
|
List<CFBuildpack> getBuildpacks() throws Exception;
|
||||||
List<CFServiceInstance> getServices() throws Exception;
|
List<CFServiceInstance> getServices() throws Exception;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * The actual Rest API version that cloud controller claims to be.
|
|
||||||
// */
|
|
||||||
// Version getApiVersion();
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * The minimum version that the CF V2 java client claims to support.
|
|
||||||
// */
|
|
||||||
// Version getSupportedApiVersion();
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Returns null if the application does not exist. Throws some kind of Exception if there's any other kind of problem.
|
|
||||||
// */
|
|
||||||
// CFApplicationDetail getApplication(String appName) throws Exception;
|
|
||||||
//
|
|
||||||
// //TODO: consider removing the getXXXSupport method and directly adding the apis that these support
|
|
||||||
// // objects provide.
|
|
||||||
// SshClientSupport getSshClientSupport() throws Exception;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// void deleteApplication(String name) throws Exception;
|
|
||||||
// void logout();
|
|
||||||
// List<CFCloudDomain> getDomains() throws Exception;
|
|
||||||
//
|
|
||||||
// List<CFApplication> getApplicationsWithBasicInfo() throws Exception;
|
|
||||||
//
|
|
||||||
// List<CFSpace> getSpaces() throws Exception;
|
|
||||||
// List<CFStack> getStacks() throws Exception;
|
|
||||||
// void restartApplication(String appName, CancelationToken token) throws Exception;
|
|
||||||
// void stopApplication(String appName) throws Exception;
|
|
||||||
// Flux<CFApplicationDetail> getApplicationDetails(List<CFApplication> appsToLookUp) throws Exception;
|
|
||||||
// String getHealthCheck(UUID appGuid) throws Exception;
|
|
||||||
// void setHealthCheck(UUID guid, String hcType) throws Exception;
|
|
||||||
// boolean applicationExists(String appName) throws Exception;
|
|
||||||
//
|
|
||||||
// //Removed in V2
|
|
||||||
// //void createApplication(CloudApplicationDeploymentProperties deploymentProperties) throws Exception;
|
|
||||||
//
|
|
||||||
// //Added since v2:
|
|
||||||
// void push(CFPushArguments args, CancelationToken cancelationToken) throws Exception;
|
|
||||||
// Map<String, String> getApplicationEnvironment(String appName) throws Exception;
|
|
||||||
// Mono<Void> deleteServiceAsync(String serviceName);
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Gets current value of the client's refresh token. Note that the token is only set once it is known.
|
|
||||||
// * Initially, if a client is created via password auth, then the refreshToken won't be known until
|
|
||||||
// * some operation has been executed.
|
|
||||||
// *
|
|
||||||
// * @return Refresh token if it is already known, null otherwise.
|
|
||||||
// */
|
|
||||||
// String getRefreshToken();
|
|
||||||
// Mono<String> getUserName();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
public class HealthChecks {
|
|
||||||
|
|
||||||
public static final String HC_NONE = "none";
|
|
||||||
public static final String HC_PORT = "port";
|
|
||||||
public static final String[] HC_ALL = {HC_NONE, HC_PORT};
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2009-2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enum used for the state of an instance
|
|
||||||
*
|
|
||||||
* Note: copied over from CF V1 client code.
|
|
||||||
*
|
|
||||||
* @author Thomas Risberg
|
|
||||||
*/
|
|
||||||
public enum InstanceState {
|
|
||||||
DOWN, STARTING, RUNNING, CRASHED, FLAPPING, UNKNOWN;
|
|
||||||
|
|
||||||
public static InstanceState valueOfWithDefault(String s) {
|
|
||||||
try {
|
|
||||||
return InstanceState.valueOf(s);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
return InstanceState.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal Software, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal Software, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface SshClientSupport {
|
|
||||||
|
|
||||||
SshHost getSshHost() throws Exception;
|
|
||||||
String getSshUser(String appName, int instance) throws Exception;
|
|
||||||
String getSshCode() throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated because it is not supported with V2. Use the method based on appName instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
String getSshUser(UUID appGuid, int instance) throws Exception;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2015, 2016 Pivotal Software, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal Software, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Info object containing various bits of info about the host to which an ssh
|
|
||||||
* client may wish to connect.
|
|
||||||
*
|
|
||||||
* @author Kris De Volder
|
|
||||||
*/
|
|
||||||
public class SshHost {
|
|
||||||
|
|
||||||
final private String host;
|
|
||||||
|
|
||||||
final private int port;
|
|
||||||
|
|
||||||
final private String fingerPrint;
|
|
||||||
|
|
||||||
public SshHost(String host, int port, String fingerPrint) {
|
|
||||||
super();
|
|
||||||
this.host = host;
|
|
||||||
this.port = port;
|
|
||||||
this.fingerPrint = fingerPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFingerPrint() {
|
|
||||||
return fingerPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "SshHost [host=" //$NON-NLS-1$
|
|
||||||
+ host + ", port=" //$NON-NLS-1$
|
|
||||||
+ port + ", fingerPrint=" //$NON-NLS-1$
|
|
||||||
+ fingerPrint + "]";//$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extrat bits of info that are 'prefetched' asynchronously to fill
|
|
||||||
* out the CFApplication with info that C2 client doesn't initially return.
|
|
||||||
*
|
|
||||||
* @author Kris De Volder
|
|
||||||
*/
|
|
||||||
public interface ApplicationExtras {
|
|
||||||
Mono<Map<String,String>> getEnv();
|
|
||||||
Mono<List<String>> getServices();
|
|
||||||
Mono<String> getBuildpack();
|
|
||||||
Mono<String> getStack();
|
|
||||||
Mono<Integer> getTimeout();
|
|
||||||
Mono<String> getCommand();
|
|
||||||
Mono<String> getHealthCheckType();
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFApplicationDetail;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFInstanceStats;
|
|
||||||
|
|
||||||
public class CFApplicationDetailData extends CFApplicationSummaryData implements CFApplicationDetail {
|
|
||||||
|
|
||||||
private List<CFInstanceStats> instanceDetails;
|
|
||||||
|
|
||||||
public CFApplicationDetailData(
|
|
||||||
CFApplicationSummaryData app,
|
|
||||||
List<CFInstanceStats> instanceDetails
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
app.getName(),
|
|
||||||
app.getInstances(),
|
|
||||||
app.getRunningInstances(),
|
|
||||||
app.getMemory(),
|
|
||||||
app.getGuid(),
|
|
||||||
app.getUris(),
|
|
||||||
app.getState(),
|
|
||||||
app.getDiskQuota(),
|
|
||||||
app.extras
|
|
||||||
);
|
|
||||||
this.instanceDetails = instanceDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CFInstanceStats> getInstanceDetails() {
|
|
||||||
return instanceDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
buf.append("CFApplicationDetail(\n");
|
|
||||||
buf.append(" name = "+getName()+"\n");
|
|
||||||
buf.append(" instance = "+getInstances()+"\n");
|
|
||||||
buf.append(" runningInstances = "+getRunningInstances()+"\n");
|
|
||||||
buf.append(" memory = "+getMemory()+"\n");
|
|
||||||
buf.append(" guid = "+getGuid()+"\n");
|
|
||||||
buf.append(" uris = "+getUris()+"\n");
|
|
||||||
buf.append(" state = "+getState()+"\n");
|
|
||||||
buf.append(" diskQuota = "+getDiskQuota()+"\n");
|
|
||||||
buf.append(" instanceDetails = "+getInstanceDetails()+"\n");
|
|
||||||
buf.append(")\n");
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFAppState;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFApplication;
|
|
||||||
|
|
||||||
public class CFApplicationSummaryData implements CFApplication {
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private int instances;
|
|
||||||
private int runningInstances;
|
|
||||||
private int memory;
|
|
||||||
private UUID guid;
|
|
||||||
private List<String> uris;
|
|
||||||
private CFAppState state;
|
|
||||||
private int diskQuota;
|
|
||||||
protected ApplicationExtras extras;
|
|
||||||
|
|
||||||
public CFApplicationSummaryData(
|
|
||||||
String name,
|
|
||||||
int instances,
|
|
||||||
int runningInstances,
|
|
||||||
int memory,
|
|
||||||
UUID guid,
|
|
||||||
List<String> uris,
|
|
||||||
CFAppState state,
|
|
||||||
int diskQuota,
|
|
||||||
ApplicationExtras extras
|
|
||||||
) {
|
|
||||||
super();
|
|
||||||
this.name = name;
|
|
||||||
this.instances = instances;
|
|
||||||
this.runningInstances = runningInstances;
|
|
||||||
this.memory = memory;
|
|
||||||
this.guid = guid;
|
|
||||||
this.uris = uris;
|
|
||||||
this.state = state;
|
|
||||||
this.diskQuota = diskQuota;
|
|
||||||
this.extras = extras;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInstances() {
|
|
||||||
return instances;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRunningInstances() {
|
|
||||||
return runningInstances;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMemory() {
|
|
||||||
return memory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getGuid() {
|
|
||||||
return guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getServices() {
|
|
||||||
return extras.getServices().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBuildpackUrl() {
|
|
||||||
return extras.getBuildpack().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getUris() {
|
|
||||||
return uris;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CFAppState getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDiskQuota() {
|
|
||||||
return diskQuota;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getTimeout() {
|
|
||||||
return extras.getTimeout().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHealthCheckType() {
|
|
||||||
return extras.getHealthCheckType().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCommand() {
|
|
||||||
return extras.getCommand().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStack() {
|
|
||||||
return extras.getStack().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getEnvAsMap() {
|
|
||||||
return extras.getEnv().block();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.ZipFile;
|
|
||||||
|
|
||||||
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Arguments passed to push operation.
|
|
||||||
*
|
|
||||||
* @author Kris De Volder
|
|
||||||
* @author Nieraj Singh
|
|
||||||
*/
|
|
||||||
public class CFPushArguments implements AutoCloseable {
|
|
||||||
private List<String> routes = ImmutableList.of();
|
|
||||||
private String appName;
|
|
||||||
private Integer memory;
|
|
||||||
private Integer diskQuota;
|
|
||||||
private Integer timeout;
|
|
||||||
private String buildpack;
|
|
||||||
private String command;
|
|
||||||
private String stack;
|
|
||||||
private String healthCheckType;
|
|
||||||
private Map<String, String> env = ImmutableMap.of();
|
|
||||||
private Integer instances;
|
|
||||||
private List<String> services = ImmutableList.of();
|
|
||||||
private ZipFile applicationData;
|
|
||||||
private boolean noStart = false;
|
|
||||||
|
|
||||||
public CFPushArguments() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAppName() {
|
|
||||||
return appName;
|
|
||||||
}
|
|
||||||
public void setAppName(String appName) {
|
|
||||||
this.appName = appName;
|
|
||||||
}
|
|
||||||
public Integer getMemory() {
|
|
||||||
return memory;
|
|
||||||
}
|
|
||||||
public void setMemory(Integer memory) {
|
|
||||||
this.memory = memory;
|
|
||||||
}
|
|
||||||
public Integer getDiskQuota() {
|
|
||||||
return diskQuota;
|
|
||||||
}
|
|
||||||
public void setDiskQuota(Integer diskQuota) {
|
|
||||||
this.diskQuota = diskQuota;
|
|
||||||
}
|
|
||||||
public Integer getTimeout() {
|
|
||||||
return timeout;
|
|
||||||
}
|
|
||||||
public void setTimeout(Integer timeout) {
|
|
||||||
this.timeout = timeout;
|
|
||||||
}
|
|
||||||
public String getBuildpack() {
|
|
||||||
return buildpack;
|
|
||||||
}
|
|
||||||
public void setBuildpack(String buildpack) {
|
|
||||||
this.buildpack = buildpack;
|
|
||||||
}
|
|
||||||
public String getCommand() {
|
|
||||||
return command;
|
|
||||||
}
|
|
||||||
public void setCommand(String command) {
|
|
||||||
this.command = command;
|
|
||||||
}
|
|
||||||
public String getStack() {
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
public void setStack(String stack) {
|
|
||||||
this.stack = stack;
|
|
||||||
}
|
|
||||||
public Map<String, String> getEnv() {
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
public void setEnv(Map<String, String> env) {
|
|
||||||
this.env = env;
|
|
||||||
}
|
|
||||||
public Integer getInstances() {
|
|
||||||
return instances;
|
|
||||||
}
|
|
||||||
public void setInstances(Integer instances) {
|
|
||||||
this.instances = instances;
|
|
||||||
}
|
|
||||||
public List<String> getServices() {
|
|
||||||
return services;
|
|
||||||
}
|
|
||||||
public void setServices(List<String> services) {
|
|
||||||
this.services = services;
|
|
||||||
}
|
|
||||||
public ZipFile getApplicationData() {
|
|
||||||
return applicationData;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void close() throws Exception {
|
|
||||||
if (applicationData!=null) {
|
|
||||||
applicationData.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void setApplicationData(File archive) throws Exception {
|
|
||||||
if (applicationData==null) {
|
|
||||||
ExceptionUtil.exception("Can only set this once", null);
|
|
||||||
}
|
|
||||||
this.applicationData = new ZipFile(archive);
|
|
||||||
}
|
|
||||||
public boolean isNoStart() {
|
|
||||||
return noStart;
|
|
||||||
}
|
|
||||||
public void setNoStart(boolean noStart) {
|
|
||||||
this.noStart = noStart;
|
|
||||||
}
|
|
||||||
public String getHealthCheckType() {
|
|
||||||
if (healthCheckType==null) {
|
|
||||||
return DeploymentProperties.DEFAULT_HEALTH_CHECK_TYPE;
|
|
||||||
}
|
|
||||||
return healthCheckType;
|
|
||||||
}
|
|
||||||
public void setHealthCheckType(String healthCheckType) {
|
|
||||||
this.healthCheckType = healthCheckType;
|
|
||||||
}
|
|
||||||
public List<String> getRoutes() {
|
|
||||||
return routes;
|
|
||||||
}
|
|
||||||
public void setRoutes(Collection<String> routes) {
|
|
||||||
this.routes = routes == null ? ImmutableList.of() : ImmutableList.copyOf(routes);
|
|
||||||
}
|
|
||||||
public void setRoutes(String... routes) {
|
|
||||||
setRoutes(ImmutableList.copyOf(routes));
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CFPushArguments [appName=" + appName + ", routes=" + routes + ", memory=" + memory + ", diskQuota="
|
|
||||||
+ diskQuota + ", timeout=" + timeout + ", buildpack=" + buildpack + ", command=" + command + ", stack="
|
|
||||||
+ stack + ", env=" + env + ", instances=" + instances + ", services=" + services + ", noStart="
|
|
||||||
+ noStart + ", healthCheckType="+ healthCheckType+" ]";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
|
||||||
|
|
||||||
import org.cloudfoundry.operations.routes.Route;
|
|
||||||
|
|
||||||
public class CFRoute {
|
|
||||||
|
|
||||||
final private String domain;
|
|
||||||
final private String host;
|
|
||||||
final private String path;
|
|
||||||
|
|
||||||
public CFRoute(Route route) {
|
|
||||||
this.domain = route.getDomain();
|
|
||||||
this.host = route.getHost();
|
|
||||||
this.path = route.getPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CFRoute(String domain, String host, String path) {
|
|
||||||
super();
|
|
||||||
this.domain = domain;
|
|
||||||
this.host = host;
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDomain() {
|
|
||||||
return domain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CFRoute [domain=" + domain + ", host=" + host + ", path=" + path + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFRoute.Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
public static class Builder {
|
|
||||||
private String domain;
|
|
||||||
private String host;
|
|
||||||
private String path = "";
|
|
||||||
|
|
||||||
public CFRoute build() {
|
|
||||||
return new CFRoute(this.domain, this.host, this.path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder domain(String domain) {
|
|
||||||
this.domain = domain;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder host(String host) {
|
|
||||||
this.host = host;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,35 +10,11 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
||||||
|
|
||||||
import java.util.List;
|
import org.cloudfoundry.operations.buildpacks.Buildpack;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.cloudfoundry.client.v2.buildpacks.BuildpackResource;
|
|
||||||
import org.cloudfoundry.client.v2.domains.DomainResource;
|
|
||||||
import org.cloudfoundry.operations.applications.ApplicationDetail;
|
|
||||||
import org.cloudfoundry.operations.applications.ApplicationSummary;
|
|
||||||
import org.cloudfoundry.operations.applications.InstanceDetail;
|
|
||||||
import org.cloudfoundry.operations.organizations.OrganizationSummary;
|
|
||||||
import org.cloudfoundry.operations.services.ServiceInstance;
|
import org.cloudfoundry.operations.services.ServiceInstance;
|
||||||
import org.cloudfoundry.operations.services.ServiceInstanceType;
|
import org.cloudfoundry.operations.services.ServiceInstanceType;
|
||||||
import org.cloudfoundry.operations.spaces.SpaceSummary;
|
|
||||||
import org.cloudfoundry.operations.stacks.Stack;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFAppState;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFApplication;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFApplicationDetail;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack;
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack;
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFCloudDomain;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFInstanceState;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFInstanceStats;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFOrganization;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance;
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance;
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFSpace;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CFStack;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Various helper methods to 'wrap' objects returned by CF client into our own
|
* Various helper methods to 'wrap' objects returned by CF client into our own
|
||||||
@@ -48,190 +24,16 @@ import com.google.common.collect.ImmutableList;
|
|||||||
*/
|
*/
|
||||||
public class CFWrappingV2 {
|
public class CFWrappingV2 {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(DefaultClientRequestsV2.class.getName());
|
|
||||||
|
|
||||||
public static CFBuildpack wrap(BuildpackResource rsrc) {
|
public static CFBuildpack wrap(Buildpack buildpack) {
|
||||||
String name = rsrc.getEntity().getName();
|
String name = buildpack.getName();
|
||||||
return new CFBuildpackImpl(name);
|
return new CFBuildpackImpl(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CFApplicationDetail wrap(ApplicationDetail details, ApplicationExtras extras) {
|
|
||||||
if (details!=null) {
|
|
||||||
List<CFInstanceStats> instances = ImmutableList.copyOf(
|
|
||||||
details.getInstanceDetails()
|
|
||||||
.stream()
|
|
||||||
.map(CFWrappingV2::wrap)
|
|
||||||
.collect(Collectors.toList())
|
|
||||||
);
|
|
||||||
CFApplicationSummaryData summary = wrapSummary(details, extras);
|
|
||||||
return new CFApplicationDetailData(
|
|
||||||
summary,
|
|
||||||
instances
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFStack wrap(Stack stack) {
|
|
||||||
if (stack!=null) {
|
|
||||||
String name = stack.getName();
|
|
||||||
return new CFStack() {
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CFStack("+name+")";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFApplicationDetail wrap(
|
|
||||||
CFApplicationSummaryData summary,
|
|
||||||
ApplicationDetail details
|
|
||||||
) {
|
|
||||||
List<CFInstanceStats> instanceDetails = ImmutableList.copyOf(
|
|
||||||
details
|
|
||||||
.getInstanceDetails()
|
|
||||||
.stream()
|
|
||||||
.map(CFWrappingV2::wrap)
|
|
||||||
.collect(Collectors.toList())
|
|
||||||
);
|
|
||||||
return new CFApplicationDetailData(summary, instanceDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFCloudDomain wrap(DomainResource domainRsrc) {
|
|
||||||
if (domainRsrc!=null) {
|
|
||||||
String name = domainRsrc.getEntity().getName();
|
|
||||||
return new CFCloudDomain() {
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CFCloudDomain("+name+")";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFInstanceStats wrap(InstanceDetail instanceDetail) {
|
|
||||||
return new CFInstanceStats() {
|
|
||||||
@Override
|
|
||||||
public CFInstanceState getState() {
|
|
||||||
try {
|
|
||||||
return CFInstanceState.valueOf(instanceDetail.getState());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
|
||||||
return CFInstanceState.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return ""+getState();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CFApplicationSummaryData wrapSummary(ApplicationDetail app, ApplicationExtras extras) {
|
|
||||||
CFAppState state;
|
|
||||||
try {
|
|
||||||
state = CFAppState.valueOf(app.getRequestedState());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
|
||||||
state = CFAppState.UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CFApplicationSummaryData(
|
|
||||||
app.getName(),
|
|
||||||
app.getInstances(),
|
|
||||||
app.getRunningInstances(),
|
|
||||||
app.getMemoryLimit(),
|
|
||||||
UUID.fromString(app.getId()),
|
|
||||||
app.getUrls(),
|
|
||||||
state,
|
|
||||||
app.getDiskQuota(),
|
|
||||||
extras
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFApplication wrap(ApplicationSummary app, ApplicationExtras extras) {
|
|
||||||
CFAppState state;
|
|
||||||
try {
|
|
||||||
state = CFAppState.valueOf(app.getRequestedState());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
|
||||||
state = CFAppState.UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CFApplicationSummaryData(
|
|
||||||
app.getName(),
|
|
||||||
app.getInstances(),
|
|
||||||
app.getRunningInstances(),
|
|
||||||
app.getMemoryLimit(),
|
|
||||||
UUID.fromString(app.getId()),
|
|
||||||
app.getUrls(),
|
|
||||||
state,
|
|
||||||
app.getDiskQuota(),
|
|
||||||
extras
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFServiceInstance wrap(ServiceInstance service) {
|
public static CFServiceInstance wrap(ServiceInstance service) {
|
||||||
return new CFServiceInstanceImpl(service);
|
return new CFServiceInstanceImpl(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CFAppState wrapAppState(String s) {
|
|
||||||
try {
|
|
||||||
return CFAppState.valueOf(s);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
|
||||||
return CFAppState.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFSpace wrap(OrganizationSummary org, SpaceSummary space) {
|
|
||||||
return new CFSpace() {
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return space.getName();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public CFOrganization getOrganization() {
|
|
||||||
return wrap(org);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public UUID getGuid() {
|
|
||||||
return UUID.fromString(space.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CFSpace("+org.getName()+" / "+getName()+")";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFOrganization wrap(OrganizationSummary org) {
|
|
||||||
return new CFOrganization() {
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return org.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getGuid() {
|
|
||||||
return UUID.fromString(org.getId());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CFBuildpack buildpack(String name) {
|
public static CFBuildpack buildpack(String name) {
|
||||||
return new CFBuildpackImpl(name);
|
return new CFBuildpackImpl(name);
|
||||||
}
|
}
|
||||||
@@ -379,8 +181,5 @@ public class CFWrappingV2 {
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,53 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2016 Pivotal, Inc.
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Pivotal, Inc. - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.springframework.ide.vscode.commons.cloudfoundry.client.v2;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for Cloud Foundry application deployment properties
|
|
||||||
*
|
|
||||||
* @author Alex Boyko
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface DeploymentProperties {
|
|
||||||
|
|
||||||
int DEFAULT_MEMORY = 1024;
|
|
||||||
int DEFAULT_INSTANCES = 1;
|
|
||||||
String DEFAULT_HEALTH_CHECK_TYPE = "port";
|
|
||||||
|
|
||||||
String getAppName();
|
|
||||||
|
|
||||||
int getMemory();
|
|
||||||
|
|
||||||
int getDiskQuota();
|
|
||||||
|
|
||||||
Integer getTimeout();
|
|
||||||
|
|
||||||
String getHealthCheckType();
|
|
||||||
|
|
||||||
String getBuildpack();
|
|
||||||
|
|
||||||
String getCommand();
|
|
||||||
|
|
||||||
String getStack();
|
|
||||||
|
|
||||||
Map<String, String> getEnvironmentVariables();
|
|
||||||
|
|
||||||
int getInstances();
|
|
||||||
|
|
||||||
List<String> getServices();
|
|
||||||
|
|
||||||
Set<String> getUris();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@ public class CFClientTest {
|
|||||||
*/
|
*/
|
||||||
@Ignore
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testGetBuildpacksFromCliParamsTarget() throws Exception {
|
public void testFromCliParamsTarget() throws Exception {
|
||||||
|
|
||||||
ClientParamsProvider cliProvider = new CfCliParamsProvider();
|
ClientParamsProvider cliProvider = new CfCliParamsProvider();
|
||||||
CloudFoundryClientFactory clientFactory = DefaultCloudFoundryClientFactoryV2.INSTANCE;
|
CloudFoundryClientFactory clientFactory = DefaultCloudFoundryClientFactoryV2.INSTANCE;
|
||||||
@@ -41,6 +41,8 @@ public class CFClientTest {
|
|||||||
|
|
||||||
List<CFBuildpack> buildPacks = target.getBuildpacks();
|
List<CFBuildpack> buildPacks = target.getBuildpacks();
|
||||||
assertTrue(!buildPacks.isEmpty());
|
assertTrue(!buildPacks.isEmpty());
|
||||||
|
List<CFServiceInstance> services = target.getServices();
|
||||||
|
assertTrue(!services.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,18 @@
|
|||||||
<id>spring-releases</id>
|
<id>spring-releases</id>
|
||||||
<name>Spring Releases</name>
|
<name>Spring Releases</name>
|
||||||
<url>http://repo.spring.io/release</url>
|
<url>http://repo.spring.io/release</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>spring-snapshots</id>
|
||||||
|
<name>Spring Snapshots</name>
|
||||||
|
<url>http://repo.spring.io/snapshot</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -63,9 +74,9 @@
|
|||||||
<jersey-2-version>2.10</jersey-2-version>
|
<jersey-2-version>2.10</jersey-2-version>
|
||||||
<lsp4j-version>0.1.0-SNAPSHOT</lsp4j-version>
|
<lsp4j-version>0.1.0-SNAPSHOT</lsp4j-version>
|
||||||
<!-- NOTE: Reactor version must match version used by the CF client -->
|
<!-- NOTE: Reactor version must match version used by the CF client -->
|
||||||
<reactor-version>3.0.4.RELEASE</reactor-version>
|
<reactor-version>3.0.5.BUILD-SNAPSHOT</reactor-version>
|
||||||
<reactor-netty>0.6.0.RELEASE</reactor-netty>
|
<reactor-netty>0.6.0.RELEASE</reactor-netty>
|
||||||
<cloudfoundry-client-version>2.1.0.RELEASE</cloudfoundry-client-version>
|
<cloudfoundry-client-version>2.3.0.BUILD-SNAPSHOT</cloudfoundry-client-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.springframework.ide.vscode.manifest.yaml;
|
package org.springframework.ide.vscode.manifest.yaml;
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
@@ -18,11 +17,11 @@ import javax.inject.Provider;
|
|||||||
import org.eclipse.lsp4j.CompletionOptions;
|
import org.eclipse.lsp4j.CompletionOptions;
|
||||||
import org.eclipse.lsp4j.ServerCapabilities;
|
import org.eclipse.lsp4j.ServerCapabilities;
|
||||||
import org.eclipse.lsp4j.TextDocumentSyncKind;
|
import org.eclipse.lsp4j.TextDocumentSyncKind;
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CfCliParamsProvider;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.ClientParamsProvider;
|
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.ClientTimeouts;
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.ClientTimeouts;
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.CloudFoundryClientFactory;
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.CloudFoundryClientFactory;
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTargetCache;
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTargetCache;
|
||||||
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CfCliParamsProvider;
|
||||||
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.ClientParamsProvider;
|
||||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.v2.DefaultCloudFoundryClientFactoryV2;
|
import org.springframework.ide.vscode.commons.cloudfoundry.client.v2.DefaultCloudFoundryClientFactoryV2;
|
||||||
import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngine;
|
import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngine;
|
||||||
import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter;
|
import org.springframework.ide.vscode.commons.languageserver.completion.VscodeCompletionEngineAdapter;
|
||||||
@@ -52,17 +51,6 @@ public class ManifestYamlLanguageServer extends SimpleLanguageServer {
|
|||||||
private YamlSchema schema;
|
private YamlSchema schema;
|
||||||
private CFTargetCache cfTargetCache;
|
private CFTargetCache cfTargetCache;
|
||||||
|
|
||||||
private static final ClientTimeouts VSCODE_CF_CLIENT_TIMEOUTS = new ClientTimeouts() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Duration getServicesTimeout() {
|
|
||||||
// Use shorter timeouts for services because it is used in dynamic
|
|
||||||
// values for content assist
|
|
||||||
return Duration.ofSeconds(15);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
public ManifestYamlLanguageServer() {
|
public ManifestYamlLanguageServer() {
|
||||||
SimpleTextDocumentService documents = getTextDocumentService();
|
SimpleTextDocumentService documents = getTextDocumentService();
|
||||||
|
|
||||||
@@ -107,7 +95,7 @@ public class ManifestYamlLanguageServer extends SimpleLanguageServer {
|
|||||||
if (cfTargetCache == null) {
|
if (cfTargetCache == null) {
|
||||||
ClientParamsProvider paramsProvider = new CfCliParamsProvider();
|
ClientParamsProvider paramsProvider = new CfCliParamsProvider();
|
||||||
CloudFoundryClientFactory clientFactory = DefaultCloudFoundryClientFactoryV2.INSTANCE;
|
CloudFoundryClientFactory clientFactory = DefaultCloudFoundryClientFactoryV2.INSTANCE;
|
||||||
cfTargetCache = new CFTargetCache(paramsProvider, clientFactory, VSCODE_CF_CLIENT_TIMEOUTS);
|
cfTargetCache = new CFTargetCache(paramsProvider, clientFactory, new ClientTimeouts());
|
||||||
}
|
}
|
||||||
return cfTargetCache;
|
return cfTargetCache;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class ManifestYmlSchema implements YamlSchema {
|
|||||||
// t_buildpack.parseWith(ManifestYmlValueParsers.fromHints(t_buildpack.toString(), buildpackProvider));
|
// t_buildpack.parseWith(ManifestYmlValueParsers.fromHints(t_buildpack.toString(), buildpackProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
YAtomicType t_service_string = f.yatomic("String");
|
YAtomicType t_service_string = f.yatomic("Service");
|
||||||
if (servicesProvider != null) {
|
if (servicesProvider != null) {
|
||||||
t_service_string.addHintProvider(servicesProvider);
|
t_service_string.addHintProvider(servicesProvider);
|
||||||
t_service_string.parseWith(ManifestYmlValueParsers.fromHints(t_service_string.toString(), servicesProvider));
|
t_service_string.parseWith(ManifestYmlValueParsers.fromHints(t_service_string.toString(), servicesProvider));
|
||||||
|
|||||||
Reference in New Issue
Block a user