use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.
the class EndpointRemovalTaskServiceTest method createEndpointState.
private static EndpointState createEndpointState() {
EndpointState endpoint = new EndpointState();
endpoint.endpointType = "aws";
endpoint.name = "aws_endpoint";
endpoint.endpointProperties = new HashMap<>();
endpoint.endpointProperties.put(REGION_KEY, "test-regionId");
endpoint.endpointProperties.put(PRIVATE_KEY_KEY, "test-secreteKey");
endpoint.endpointProperties.put(PRIVATE_KEYID_KEY, "test-accessKey");
endpoint.tenantLinks = Collections.singletonList("tenant-1");
return endpoint;
}
use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.
the class EndpointServiceTests method testCreateAndThenValidate.
public void testCreateAndThenValidate(EndpointService.EndpointState ep) throws Throwable {
EndpointAllocationTaskState createEndpoint = new EndpointAllocationTaskState();
createEndpoint.endpointState = ep;
createEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, createEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
this.host.waitForFinishedTask(EndpointAllocationTaskState.class, outTask.documentSelfLink);
EndpointAllocationTaskState taskState = getServiceSynchronously(outTask.documentSelfLink, EndpointAllocationTaskState.class);
assertNotNull(taskState);
assertNotNull(taskState.endpointState);
ServiceDocument endpointState = taskState.endpointState;
assertNotNull(endpointState.documentSelfLink);
// check endpoint document was created
EndpointService.EndpointState endpoint = getServiceSynchronously(endpointState.documentSelfLink, EndpointService.EndpointState.class);
// now do validation
EndpointAllocationTaskState validateEndpoint = new EndpointAllocationTaskState();
validateEndpoint.endpointState = endpoint;
validateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : EnumSet.noneOf(TaskOption.class);
validateEndpoint.options.add(TaskOption.VALIDATE_ONLY);
EndpointAllocationTaskState validateEndpointTask = TestUtils.doPost(this.host, validateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
this.host.waitForFinishedTask(EndpointAllocationTaskState.class, validateEndpointTask.documentSelfLink);
}
use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.
the class AWSPowerServiceTest method configureEndpoint.
private EndpointState configureEndpoint() throws Throwable {
EndpointState ep = createEndpointState();
EndpointAllocationTaskState configureEndpoint = new EndpointAllocationTaskState();
configureEndpoint.endpointState = ep;
configureEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
configureEndpoint.taskInfo = new TaskState();
configureEndpoint.taskInfo.isDirect = true;
EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, configureEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
// outTask.documentSelfLink);
return outTask.endpointState;
}
use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.
the class AWSPowerServiceTest method createEndpointState.
private EndpointState createEndpointState() {
EndpointState endpoint = new EndpointState();
endpoint.endpointType = EndpointType.aws.name();
endpoint.name = EndpointType.aws.name();
endpoint.endpointProperties = new HashMap<>();
endpoint.endpointProperties.put(REGION_KEY, this.regionId);
endpoint.endpointProperties.put(PRIVATE_KEY_KEY, this.secretKey);
endpoint.endpointProperties.put(PRIVATE_KEYID_KEY, this.accessKey);
return endpoint;
}
use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.
the class BaseResourceOperationTest method createEndpointState.
private static EndpointState createEndpointState(String endpointType) {
EndpointState endpoint = new EndpointState();
endpoint.endpointType = endpointType;
endpoint.name = endpointType;
endpoint.tenantLinks = new ArrayList<>(1);
endpoint.tenantLinks.add("tenant1-link");
return endpoint;
}
Aggregations