use of com.vmware.photon.controller.model.adapters.awsadapter.enumeration.AWSNetworkStateEnumerationAdapterService.AWSNetworkEnumerationRequest in project photon-model by vmware.
the class AWSEnumerationAndCreationAdapterService method refreshVPCInformation.
private void refreshVPCInformation(EnumerationCreationContext aws, AWSEnumerationRefreshSubStage next) {
AWSNetworkEnumerationRequest networkEnumeration = new AWSNetworkEnumerationRequest();
networkEnumeration.tenantLinks = aws.parentCompute.tenantLinks;
networkEnumeration.endpointAuth = aws.endpointAuth;
networkEnumeration.regionId = aws.request.regionId;
networkEnumeration.request = aws.request.original;
networkEnumeration.parentComputeLink = aws.request.parentCompute.documentSelfLink;
Operation patchNetworkOperation = Operation.createPatch(this, AWSNetworkStateEnumerationAdapterService.SELF_LINK).setBody(networkEnumeration).setReferer(UriUtils.buildUri(getHost().getPublicUri(), getSelfLink()));
this.getHost().sendWithDeferredResult(patchNetworkOperation, AWSNetworkStateEnumerationAdapterService.AWSNetworkEnumerationResponse.class).thenAccept(networkResponse -> {
logFine(() -> "Successfully enumerated network states");
aws.enumeratedNetworks = networkResponse;
aws.refreshSubStage = next;
processRefreshSubStages(aws);
}).exceptionally(throwable -> {
if (throwable != null) {
logWarning(() -> String.format("Failed to enumerate network states: %s ", throwable.getLocalizedMessage()));
aws.error = throwable;
aws.refreshSubStage = next;
processRefreshSubStages(aws);
}
return null;
});
}
Aggregations