@Test public void handleRequest_SelfManagedSS_Success() { when(proxyClient.client().describeStackSet(any(DescribeStackSetRequest.class))) .thenReturn(DESCRIBE_SELF_MANAGED_STACK_SET_RESPONSE); when(proxyClient.client().listStackInstances(any(ListStackInstancesRequest.class))) .thenReturn(LIST_SELF_MANAGED_STACK_SET_RESPONSE); when(proxyClient.client().describeStackInstance(any(DescribeStackInstanceRequest.class))) .thenReturn(DESCRIBE_STACK_INSTANCE_RESPONSE_1, DESCRIBE_STACK_INSTANCE_RESPONSE_2, DESCRIBE_STACK_INSTANCE_RESPONSE_3, DESCRIBE_STACK_INSTANCE_RESPONSE_4); final ProgressEvent<ResourceModel, CallbackContext> response = handler.handleRequest(proxy, request, new CallbackContext(), proxyClient, logger); assertThat(response).isNotNull(); assertThat(response.getStatus()).isEqualTo(OperationStatus.SUCCESS); assertThat(response.getCallbackContext()).isNull(); assertThat(response.getCallbackDelaySeconds()).isEqualTo(0); assertThat(response.getResourceModel()).isEqualTo(SELF_MANAGED_MODEL_FOR_READ); assertThat(response.getResourceModels()).isNull(); assertThat(response.getMessage()).isNull(); assertThat(response.getErrorCode()).isNull(); verify(proxyClient.client()).describeStackSet(any(DescribeStackSetRequest.class)); verify(proxyClient.client()).listStackInstances(any(ListStackInstancesRequest.class)); verify(proxyClient.client(), times(4)).describeStackInstance(any(DescribeStackInstanceRequest.class)); }
protected ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final ProxyClient<CloudFormationClient> proxyClient, final Logger logger) { this.logger = logger; final ResourceModel model = request.getDesiredResourceState(); return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(ResourceModelBuilder.builder() .proxyClient(proxyClient) .stackSet(describeStackSet(proxyClient, model.getStackSetId())) .build().buildModel()) .status(OperationStatus.SUCCESS) .build(); }
ReadHandler extends BaseHandlerStd { protected ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final ProxyClient<CloudFormationClient> proxyClient, final Logger logger) { this.logger = logger; final ResourceModel model = request.getDesiredResourceState(); return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(ResourceModelBuilder.builder() .proxyClient(proxyClient) .stackSet(describeStackSet(proxyClient, model.getStackSetId())) .build().buildModel()) .status(OperationStatus.SUCCESS) .build(); } }
ReadHandler extends BaseHandlerStd { protected ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final ProxyClient<CloudFormationClient> proxyClient, final Logger logger) { this.logger = logger; final ResourceModel model = request.getDesiredResourceState(); return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(ResourceModelBuilder.builder() .proxyClient(proxyClient) .stackSet(describeStackSet(proxyClient, model.getStackSetId())) .build().buildModel()) .status(OperationStatus.SUCCESS) .build(); }  }
ReadHandler extends BaseHandlerStd { protected ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final ProxyClient<CloudFormationClient> proxyClient, final Logger logger) { this.logger = logger; final ResourceModel model = request.getDesiredResourceState(); return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(ResourceModelBuilder.builder() .proxyClient(proxyClient) .stackSet(describeStackSet(proxyClient, model.getStackSetId())) .build().buildModel()) .status(OperationStatus.SUCCESS) .build(); }   }
ReadHandler extends BaseHandlerStd { protected ProgressEvent<ResourceModel, CallbackContext> handleRequest( final AmazonWebServicesClientProxy proxy, final ResourceHandlerRequest<ResourceModel> request, final CallbackContext callbackContext, final ProxyClient<CloudFormationClient> proxyClient, final Logger logger) { this.logger = logger; final ResourceModel model = request.getDesiredResourceState(); return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(ResourceModelBuilder.builder() .proxyClient(proxyClient) .stackSet(describeStackSet(proxyClient, model.getStackSetId())) .build().buildModel()) .status(OperationStatus.SUCCESS) .build(); }    }