class GcpDiskResourceBuilder extends AbstractGcpComputeBuilder {

    @Override
    public List<CloudResource> build(GcpContext context, long privateId, AuthenticatedContext auth, Group group,
            List<CloudResource> buildableResources, CloudStack cloudStack) throws Exception {
        String projectId = context.getProjectId();
        Location location = context.getLocation();

        Disk disk = new Disk();
        disk.setSizeGb((long) group.getRootVolumeSize());
        disk.setName(buildableResources.get(0).getName());
        disk.setKind(GcpDiskType.HDD.getUrl(projectId, location.getAvailabilityZone()));

        InstanceTemplate template = group.getReferenceInstanceTemplate();
        gcpDiskEncryptionService.addEncryptionKeyToDisk(template, disk);

        Map<String, String> customTags = new HashMap<>();
        customTags.putAll(cloudStack.getTags());
        disk.setLabels(customTags);

        Insert insDisk = context.getCompute().disks().insert(projectId, location.getAvailabilityZone().value(), disk);
        insDisk.setSourceImage(GcpStackUtil.getAmbariImage(projectId, cloudStack.getImage().getImageName()));
        try {
            Operation operation = insDisk.execute();
            if (operation.getHttpErrorStatusCode() != null) {
                throw new GcpResourceException(operation.getHttpErrorMessage(), resourceType(), buildableResources.get(0).getName());
            }
            return Collections.singletonList(createOperationAwareCloudResource(buildableResources.get(0), operation));
        } catch (GoogleJsonResponseException e) {
            throw new GcpResourceException(checkException(e), resourceType(), buildableResources.get(0).getName());
        }
    }

}