Skip to content

Commit 1f7941a

Browse files
committed
#86 added method getAvailableDropletsByTagName
1 parent 60e2ab3 commit 1f7941a

File tree

3 files changed

+312
-315
lines changed

3 files changed

+312
-315
lines changed

src/main/java/com/myjeeva/digitalocean/DigitalOcean.java

Lines changed: 74 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ Delete deleteDropletByTagName(String tagName)
309309
* @throws DigitalOceanException if request had interruption [
310310
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
311311
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
312+
*
313+
* @since v2.0
312314
*/
313315
Droplets getDropletNeighbors(Integer dropletId, Integer pageNo)
314316
throws DigitalOceanException, RequestUnsuccessfulException;
@@ -322,11 +324,34 @@ Droplets getDropletNeighbors(Integer dropletId, Integer pageNo)
322324
* @throws DigitalOceanException if request had interruption [
323325
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
324326
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
327+
*
328+
* @since v2.0
325329
*/
326330
Neighbors getAllDropletNeighbors(Integer pageNo)
327331
throws DigitalOceanException, RequestUnsuccessfulException;
328332

333+
/**
334+
* To list Droplets by a tag.
335+
*
336+
* The response will match that of regular droplet listing request but will be filtered to only
337+
* include the tagged Droplets.
338+
*
339+
* @param tagName for tagName
340+
* @param pageNo for pagination
341+
* @param perPage for pagination
342+
* @return {@link Droplets}
343+
* @throws DigitalOceanException if request had interruption [
344+
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
345+
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
346+
*
347+
* @since v2.16
348+
*/
349+
Droplets getAvailableDropletsByTagName(String tagName, Integer pageNo, Integer perPage)
350+
throws DigitalOceanException, RequestUnsuccessfulException;
351+
352+
// ===========================================
329353
// Droplet Action methods
354+
// ===========================================
330355

331356
/**
332357
* Method allows you to reboot a droplet. This is the preferred method to use if a server is not
@@ -446,7 +471,7 @@ Action resizeDroplet(Integer dropletId, String size)
446471
* @since v1.0
447472
*/
448473
Action resizeDroplet(Integer dropletId, String size, Boolean disk)
449-
throws DigitalOceanException, RequestUnsuccessfulException;
474+
throws DigitalOceanException, RequestUnsuccessfulException;
450475

451476
/**
452477
* Method allows you to take a snapshot of the running droplet, which can later be restored or
@@ -709,6 +734,7 @@ Action getFloatingIPActionInfo(String ipAddress, Integer actionId)
709734
// ==============================================
710735
// Images manipulation (aka Distribution) methods
711736
// ==============================================
737+
712738
/**
713739
* Method returns all the available images that can be accessed by your OAuth Token. You will have
714740
* access to all public images by default, and any snapshots or backups that you have created in
@@ -840,6 +866,7 @@ Action transferImage(Integer imageId, String regionSlug)
840866
// ===========================================
841867
// Regions (aka Data Centers) methods
842868
// ===========================================
869+
843870
/**
844871
* Method returns all the available regions within the DigitalOcean cloud.
845872
*
@@ -857,6 +884,7 @@ Regions getAvailableRegions(Integer pageNo)
857884
// ===========================================
858885
// Sizes (aka Available Droplet Plans) methods
859886
// ===========================================
887+
860888
/**
861889
* Method returns all the available sizes that can be used to create a droplet.
862890
*
@@ -874,6 +902,7 @@ Sizes getAvailableSizes(Integer pageNo)
874902
// ===========================================
875903
// Domain manipulation methods
876904
// ===========================================
905+
877906
/**
878907
* Method returns all of your available domains from DNS control panel
879908
*
@@ -1010,6 +1039,7 @@ Delete deleteDomainRecord(String domainName, Integer recordId)
10101039
// ===========================================
10111040
// SSH Key manipulation methods
10121041
// ===========================================
1042+
10131043
/**
10141044
* Method lists all the available public SSH keys in your account that can be added to a droplet.
10151045
*
@@ -1123,6 +1153,7 @@ Key updateKey(String fingerprint, String newSshKeyName)
11231153
// ===========================================
11241154
// Floating IP manipulation methods
11251155
// ===========================================
1156+
11261157
/**
11271158
* Method will list all of the Floating IPs available from your account.
11281159
*
@@ -1634,8 +1665,8 @@ Delete deleteSnapshot(String snapshotId)
16341665
*
16351666
* @since v2.11
16361667
*/
1637-
LoadBalancer createLoadBalancer(LoadBalancer loadBalancer) throws DigitalOceanException,
1638-
RequestUnsuccessfulException;
1668+
LoadBalancer createLoadBalancer(LoadBalancer loadBalancer)
1669+
throws DigitalOceanException, RequestUnsuccessfulException;
16391670

16401671
/**
16411672
* Method returns complete information for given load balancer ID.
@@ -1681,8 +1712,8 @@ LoadBalancers getAvailableLoadBalancers(Integer pageNo, Integer perPage)
16811712
*
16821713
* @since v2.11
16831714
*/
1684-
LoadBalancer updateLoadBalancer(LoadBalancer loadBalancer) throws DigitalOceanException,
1685-
RequestUnsuccessfulException;
1715+
LoadBalancer updateLoadBalancer(LoadBalancer loadBalancer)
1716+
throws DigitalOceanException, RequestUnsuccessfulException;
16861717

16871718
/**
16881719
* Method allows you to assign a Droplet to a Load Balancer instance.
@@ -1698,8 +1729,7 @@ LoadBalancer updateLoadBalancer(LoadBalancer loadBalancer) throws DigitalOceanEx
16981729
* @since v2.11
16991730
*/
17001731
Response addDropletsToLoadBalancer(String loadBalancerId, List<Integer> dropletIds)
1701-
throws DigitalOceanException,
1702-
RequestUnsuccessfulException;
1732+
throws DigitalOceanException, RequestUnsuccessfulException;
17031733

17041734
/**
17051735
* Method allows you to remove a Droplet from a Load Balancer instance.
@@ -1715,8 +1745,7 @@ Response addDropletsToLoadBalancer(String loadBalancerId, List<Integer> dropletI
17151745
* @since v2.11
17161746
*/
17171747
Delete removeDropletsFromLoadBalancer(String loadBalancerId, List<Integer> dropletIds)
1718-
throws DigitalOceanException,
1719-
RequestUnsuccessfulException;
1748+
throws DigitalOceanException, RequestUnsuccessfulException;
17201749

17211750
/**
17221751
* Method allows you to add an additional forwarding rule to a Load Balancer instance.
@@ -1732,8 +1761,8 @@ Delete removeDropletsFromLoadBalancer(String loadBalancerId, List<Integer> dropl
17321761
* @since v2.11
17331762
*/
17341763
Response addForwardingRulesToLoadBalancer(String loadBalancerId,
1735-
List<ForwardingRules> forwardingRules) throws DigitalOceanException,
1736-
RequestUnsuccessfulException;
1764+
List<ForwardingRules> forwardingRules)
1765+
throws DigitalOceanException, RequestUnsuccessfulException;
17371766

17381767
/**
17391768
* Method allows you to remove forwarding rules from a Load Balancer instance.
@@ -1749,8 +1778,8 @@ Response addForwardingRulesToLoadBalancer(String loadBalancerId,
17491778
* @since v2.11
17501779
*/
17511780
Delete removeForwardingRulesFromLoadBalancer(String loadBalancerId,
1752-
List<ForwardingRules> forwardingRules) throws DigitalOceanException,
1753-
RequestUnsuccessfulException;
1781+
List<ForwardingRules> forwardingRules)
1782+
throws DigitalOceanException, RequestUnsuccessfulException;
17541783

17551784
/**
17561785
* Method allows you to delete a Load Balancer instance, disassociating any Droplets assigned to
@@ -1764,8 +1793,8 @@ Delete removeForwardingRulesFromLoadBalancer(String loadBalancerId,
17641793
*
17651794
* @since v2.11
17661795
*/
1767-
Delete deleteLoadBalancer(String loadBalancerId) throws DigitalOceanException,
1768-
RequestUnsuccessfulException;
1796+
Delete deleteLoadBalancer(String loadBalancerId)
1797+
throws DigitalOceanException, RequestUnsuccessfulException;
17691798

17701799
// ===========================================
17711800
// Certificates manipulation methods
@@ -1784,8 +1813,7 @@ Delete deleteLoadBalancer(String loadBalancerId) throws DigitalOceanException,
17841813
* @since v2.12
17851814
**/
17861815
Certificates getAvailableCertificates(Integer pageNo, Integer perPage)
1787-
throws DigitalOceanException,
1788-
RequestUnsuccessfulException;
1816+
throws DigitalOceanException, RequestUnsuccessfulException;
17891817

17901818
/**
17911819
* <p>
@@ -1814,8 +1842,8 @@ Certificates getAvailableCertificates(Integer pageNo, Integer perPage)
18141842
*
18151843
* @since v2.12
18161844
*/
1817-
Certificate createCertificate(Certificate certificate) throws DigitalOceanException,
1818-
RequestUnsuccessfulException;
1845+
Certificate createCertificate(Certificate certificate)
1846+
throws DigitalOceanException, RequestUnsuccessfulException;
18191847

18201848
/**
18211849
* Method returns the Certificate information for given certificate ID.
@@ -1828,8 +1856,8 @@ Certificate createCertificate(Certificate certificate) throws DigitalOceanExcept
18281856
*
18291857
* @since v2.12
18301858
*/
1831-
Certificate getCertificateInfo(String certificateId) throws DigitalOceanException,
1832-
RequestUnsuccessfulException;
1859+
Certificate getCertificateInfo(String certificateId)
1860+
throws DigitalOceanException, RequestUnsuccessfulException;
18331861

18341862
/**
18351863
* Method allows you to delete a Certificate by Id from your account.
@@ -1842,18 +1870,18 @@ Certificate getCertificateInfo(String certificateId) throws DigitalOceanExceptio
18421870
*
18431871
* @since v2.12
18441872
*/
1845-
Delete deleteCertificate(String certificateId) throws DigitalOceanException,
1846-
RequestUnsuccessfulException;
1847-
1848-
//===========================================
1873+
Delete deleteCertificate(String certificateId)
1874+
throws DigitalOceanException, RequestUnsuccessfulException;
1875+
1876+
// ===========================================
18491877
// Firewalls manipulation methods
18501878
// ===========================================
1851-
1879+
18521880
/**
18531881
* Method allows you to add a new firewall to restrict network access to and from a Droplet.
18541882
*
1855-
* The Firewall object passed in param can have a list of dropletIds set as dropletIds
1856-
* attribute. In this case, given Droplets will use the Firewall rules.
1883+
* The Firewall object passed in param can have a list of dropletIds set as dropletIds attribute.
1884+
* In this case, given Droplets will use the Firewall rules.
18571885
*
18581886
* You may also use a Droplet tag to assign a group of Droplets to use the Firewall in place of a
18591887
* list of Droplet IDs. In this case, set the tag attribute of the Firewall object passed in
@@ -1867,9 +1895,9 @@ Delete deleteCertificate(String certificateId) throws DigitalOceanException,
18671895
*
18681896
* @since v2.16
18691897
*/
1870-
Firewall createFirewall(Firewall firewall) throws DigitalOceanException,
1871-
RequestUnsuccessfulException;
1872-
1898+
Firewall createFirewall(Firewall firewall)
1899+
throws DigitalOceanException, RequestUnsuccessfulException;
1900+
18731901
/**
18741902
* Method returns complete information for given firewall ID.
18751903
*
@@ -1883,12 +1911,12 @@ Firewall createFirewall(Firewall firewall) throws DigitalOceanException,
18831911
*/
18841912
Firewall getFirewallInfo(String firewallId)
18851913
throws DigitalOceanException, RequestUnsuccessfulException;
1886-
1914+
18871915
/**
1888-
* Method allows you to update an existing fireawll. The Firewall object passed in param
1889-
* should contain a full representation of the Firewall including existing attributes. It may
1890-
* contain one of the dropletIds or tag parameter as they are mutually exclusive. Note that any
1891-
* attribute that is not provided will be reset to its default value.
1916+
* Method allows you to update an existing fireawll. The Firewall object passed in param should
1917+
* contain a full representation of the Firewall including existing attributes. It may contain one
1918+
* of the dropletIds or tag parameter as they are mutually exclusive. Note that any attribute that
1919+
* is not provided will be reset to its default value.
18921920
*
18931921
* @param firewall the instance of the firewall class
18941922
* @return {@link Firewall}
@@ -1898,12 +1926,12 @@ Firewall getFirewallInfo(String firewallId)
18981926
*
18991927
* @since v2.16
19001928
*/
1901-
Firewall updateFirewall(Firewall firewall) throws DigitalOceanException,
1902-
RequestUnsuccessfulException;
1903-
1929+
Firewall updateFirewall(Firewall firewall)
1930+
throws DigitalOceanException, RequestUnsuccessfulException;
1931+
19041932
/**
1905-
* Method allows you to delete a Firewall instance, disassociating any Droplets assigned to
1906-
* it and removing it from your account.
1933+
* Method allows you to delete a Firewall instance, disassociating any Droplets assigned to it and
1934+
* removing it from your account.
19071935
*
19081936
* @param firewallId the id of the firewall
19091937
* @return {@link Delete}
@@ -1913,13 +1941,13 @@ Firewall updateFirewall(Firewall firewall) throws DigitalOceanException,
19131941
*
19141942
* @since v2.16
19151943
*/
1916-
Delete deleteFirewall(String firewallId) throws DigitalOceanException,
1917-
RequestUnsuccessfulException;
1944+
Delete deleteFirewall(String firewallId)
1945+
throws DigitalOceanException, RequestUnsuccessfulException;
1946+
19181947

1919-
19201948
/**
1921-
* Method returns all available firewalls that are currently running in your account. All available
1922-
* API information is presented for each firewall.
1949+
* Method returns all available firewalls that are currently running in your account. All
1950+
* available API information is presented for each firewall.
19231951
*
19241952
* @param pageNo for pagination
19251953
* @param perPage no. of items per page

0 commit comments

Comments
 (0)