@Override public Droplets createDroplets(Droplet droplet) throws DigitalOceanException, RequestUnsuccessfulException { if (null == droplet || (null == droplet.getNames() || droplet.getNames().isEmpty()) || null == droplet.getRegion() || null == droplet.getSize() || (null == droplet.getImage() || (null == droplet.getImage().getId() && null == droplet.getImage().getSlug()))) { throw new IllegalArgumentException( "Missing required parameters [Names, Region Slug, Size Slug, Image Id/Slug] for creating multiple droplets."); } if (StringUtils.isNotBlank(droplet.getName())) { throw new IllegalArgumentException( "Name parameter is not allowed, while creating multiple droplet instead use 'names' attributes."); } return (Droplets) perform(new ApiRequest(ApiAction.CREATE_DROPLETS, droplet)).getData(); }
@Override public Droplet createDroplet(Droplet droplet) throws DigitalOceanException, RequestUnsuccessfulException { if (null == droplet || StringUtils.isBlank(droplet.getName()) || null == droplet.getRegion() || null == droplet.getSize() || (null == droplet.getImage() || (null == droplet.getImage().getId() && null == droplet.getImage().getSlug()))) { throw new IllegalArgumentException( "Missing required parameters [Name, Region Slug, Size Slug, Image Id/Slug] for create droplet."); } return (Droplet) perform(new ApiRequest(ApiAction.CREATE_DROPLET, droplet)).getData(); }
@Override public Droplets createDroplets(Droplet droplet) throws DigitalOceanException, RequestUnsuccessfulException { if (null == droplet || (null == droplet.getNames() || droplet.getNames().isEmpty()) || null == droplet.getRegion() || null == droplet.getSize() || (null == droplet.getImage() || (null == droplet.getImage().getId() && null == droplet.getImage().getSlug()))) { throw new IllegalArgumentException( "Missing required parameters [Names, Region Slug, Size Slug, Image Id/Slug] for creating multiple droplets."); } if (StringUtils.isNotBlank(droplet.getName())) { throw new IllegalArgumentException( "Name parameter is not allowed, while creating multiple droplet instead use 'names' attributes."); } return (Droplets) perform(new ApiRequest(ApiAction.CREATE_DROPLETS, droplet)).getData(); }
@Override public Droplet createDroplet(Droplet droplet) throws DigitalOceanException, RequestUnsuccessfulException { if (null == droplet || StringUtils.isBlank(droplet.getName()) || null == droplet.getRegion() || null == droplet.getSize() || (null == droplet.getImage() || (null == droplet.getImage().getId() && null == droplet.getImage().getSlug()))) { throw new IllegalArgumentException( "Missing required parameters [Name, Region Slug, Size Slug, Image Id/Slug] for create droplet."); } return (Droplet) perform(new ApiRequest(ApiAction.CREATE_DROPLET, droplet)).getData(); }
final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("name", droplet.getName());
final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("name", droplet.getName());