Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushs92 committed Dec 17, 2017
1 parent be36c97 commit ba1c65c
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 29 deletions.
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,120 @@ to indicate error. In such a case, linode4j would throw `LinodeException`, which
}
```

# Methods #

1. Linode

```java
Page<Linode> getLinodes(int pageNo);

Linode getLinodeById(int linodeId);

void createLinode(LinodeCreateRequest request);

void deleteLinode(int linodeId);

void bootLinode(int linodeId);

void bootLinode(int linodeId, Integer configId);

void cloneLinode(int linodeId, LinodeCloneRequest request);

void kvmifyLinode(int linodeId);

void mutateLinode(int linodeId);

void rebootLinode(int linodeId);

void rebootLinode(int linodeId, Integer configId);

LinodeRebuildResponse rebuildLinode(int linodeId, LinodeRebuildRequest request);

void rescueLinode(int linodeId, Devices devices);

void resizeLinode(int linodeId, String linodeType);

void shutdownLinode(int linodeId);

Page<BlockStorageVolume> getBlockStorageVolumesByLinodeId(int linodeId);
```

2. Linode Types
```java

Page<LinodeType> getLinodeTypes(int pageNo);

LinodeType getLinodeTypeById(String linodeTypeId);

```

3. Kernel
```java

Page<LinodeType> getLinodeTypes(int pageNo);
LinodeType getLinodeTypeById(String linodeTypeId);

```

4. Image
```java
Page<Image> getImages(int pageNo);

Image getImageById(int imageId);

void deleteImage(int imageId);

```

5. Account, Invoice, Notifications

```java

Page<AccountEvent> getAccountEvents(int pageNo);

AccountEvent getAccountEventById(int accountEventId);

void markAccountEventAsRead(int accountEventId);

void markAccountEventsAsSeen(int accountEventId);

Page<Invoice> getInvoices(int pageNo);

Invoice getInvoiceById(int invoiceId);

Page<InvoiceItem> getInvoiceItemsByInvoiceId(int invoiceId);

Page<AccountNotification> getAccountNotifications(int pageNo);

```

6. Regions

```java
Page<Region> getRegions(int pageNo);

Region getRegionById(String regionId);

```

7. Volumes
```java
Page<BlockStorageVolume> getVolumes(int pageNo);

BlockStorageVolume getVolumeById(int volumeId);

void createVolume(BlockStorageVolumeCreateRequest request);

void deleteVolume(int volumeId);

void attachVolumeToLinode(int volumeId, BlockStorageVolumeAttachRequest request);

void cloneVolume(int volumeId, String label);

void detachVolume(int volumeId);

```

# Contribute #

Contributions are welcome, and are subject to the following guidelines:
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/in/ankushs/linode4j/api/LinodeApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/
public interface LinodeApi {


// Linodes
Page<Linode> getLinodes(int pageNo);

Expand Down Expand Up @@ -59,15 +58,17 @@ public interface LinodeApi {

Page<BlockStorageVolume> getBlockStorageVolumesByLinodeId(int linodeId);

//Linode types
Page<LinodeType> getLinodeTypes(int pageNo);

LinodeType getLinodeTypeById(String linodeTypeId);

//Kernel
Page<Kernel> getKernels(int pageNo);

Kernel getKernelById(String id);

//~~~~~ Image ~~~~~~
//Image
Page<Image> getImages(int pageNo);

Image getImageById(int imageId);
Expand All @@ -94,7 +95,6 @@ public interface LinodeApi {

Page<InvoiceItem> getInvoiceItemsByInvoiceId(int invoiceId);


Page<AccountNotification> getAccountNotifications(int pageNo);


Expand Down
16 changes: 0 additions & 16 deletions src/main/java/in/ankushs/linode4j/api/LinodeApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ public void rebootLinode(final int linodeId, final Integer configId) {
@Override
public LinodeRebuildResponse rebuildLinode(final int linodeId, final LinodeRebuildRequest request) {
PreConditions.notNull(request, "request cannot be null");
PreConditions.notEmptyString(request.getDistribution(), "distribution is a required param. It cannot be null or empty");
PreConditions.notEmptyString(request.getRootPassword(), "rootPassword is a required param. It cannot be null or empty");

val url = LINODE_REBUILD.replace("{linode_id}", String.valueOf(linodeId));
Expand Down Expand Up @@ -642,19 +641,4 @@ private static boolean okResponse(final int statusCode) {
return statusCode == HttpStatusCode.OK.getCode();
}

public static void main(String[] args) {
final String oauthToken = "";
//Connect with Linode
final LinodeApiClient api = new LinodeApiClient(oauthToken);

final int pageNo = 1;
final Page<BlockStorageVolume> pagedVolumes = api.getVolumes(pageNo);
final Set<BlockStorageVolume> volumes = pagedVolumes.getContent();
volumes.forEach(volume -> {
System.out.println(volume);
});

val volume = api.getVolumeById(1161);
System.out.println(volume);
}
}
1 change: 0 additions & 1 deletion src/main/java/in/ankushs/linode4j/constants/LinodeUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,4 @@ public final class LinodeUrl {
public static final String VOLUME_BY_ID_CLONE = BASE_URL_V4 + "/volumes/{volume_id}/clone";
public static final String VOLUME_BY_ID_DETACH = BASE_URL_V4 + "/volumes/{volume_id}/detach";


}
3 changes: 0 additions & 3 deletions src/main/java/in/ankushs/linode4j/model/linode/Linode.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public final class Linode {
@JsonProperty("region")
private final String region;

@JsonProperty("distribution")
private final String distribution;

@JsonProperty("display")
private final String displayGroup;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public final class LinodeCreateRequest {
@JsonProperty(value = "group")
private final String group;

@JsonProperty(value = "distribution")
private final String distribution;

@JsonProperty(value = "root_pass")
private final String rootPass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
@Builder
public class LinodeRebuildRequest {

@JsonProperty(value = "distribution", required = true)
private final String distribution;

@JsonProperty("image")
private final Integer image;

Expand Down

0 comments on commit ba1c65c

Please sign in to comment.