ACCEPT_HDR_FORMAT, DATE_FORMAT, HOSTNAME, MEDIA_TYPE_JSON, URI_SCHEME, USER_AGENT, UTC_TIMEZONE, UTF_8
Constructor and Description |
---|
PacketClient(java.lang.String authToken,
java.lang.String version)
Constructor for creating Packet API Client Instance.
|
PacketClient(java.lang.String authToken,
java.lang.String version,
org.apache.http.impl.client.CloseableHttpClient httpClient)
Constructor for creating Packet API Client Instance with HTTP Client.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
acceptInvite(java.lang.String invitationId)
To accept user invitation.
|
java.lang.Boolean |
acceptTransfer(java.lang.String transferId)
To accept project ownership transfer.
|
Email |
addEmailAddress(Email email)
Add email address to current user profile.
|
Device |
createDevice(java.lang.String projectId,
Device device)
Creating new device on packet project.
|
Project |
createProject(Project project)
Create a project on your packet account.
|
SshKey |
createSshKey(SshKey sshKey)
To create a new SSH key on packet account.
|
java.lang.Boolean |
declineInvite(java.lang.String invitationId)
To decline user invitation.
|
java.lang.Boolean |
declineTransfer(java.lang.String transferId)
To decline project ownership transfer.
|
java.lang.Boolean |
deleteDevice(java.lang.String deviceId)
To delete a device from Packet project and deprovisions it in packet datacenter.
|
java.lang.Boolean |
deleteEmailAddress(java.lang.String emailId)
To delete email address from current user profile.
|
java.lang.Boolean |
deleteIpAddress(java.lang.String ipAddressId)
To remove an IP reservation from the project.
|
java.lang.Boolean |
deleteMembership(java.lang.String membershipId)
To deletes a membership record and also it will remove the user from the project.
|
java.lang.Boolean |
deleteProject(java.lang.String projectId)
Deletes a device and de-provisions it in our datacenter.
|
java.lang.Boolean |
deleteSshKey(java.lang.String sshKeyId)
To delete SSH key from packet account.
|
Metrics |
deviceTraffic(java.lang.String deviceId,
TrafficDirection direction,
java.util.Date timeframeStart,
java.util.Date timeframeEnd)
To get traffic information for device.
|
Metrics |
deviceTraffic(java.lang.String deviceId,
TrafficDirection direction,
java.util.Date timeframeStart,
java.util.Date timeframeEnd,
MetricInterval interval,
TrafficBucket bucket)
To get traffic information for device.
|
User |
getCurrentUser()
To get current user information.
|
Device |
getDevice(java.lang.String deviceId)
To get single device information.
|
Events |
getDeviceEvents(java.lang.String deviceId,
java.lang.Integer pageNo,
java.lang.Integer perPage)
To fetch all the events belongs to particular device.
|
Devices |
getDevices(java.lang.String projectId,
java.lang.Integer pageNo,
java.lang.Integer perPage)
To get all available devices from your packet account on particular project.
|
Email |
getEmailAddress(java.lang.String emailId)
To fetch one email address information.
|
Event |
getEvent(java.lang.String eventId)
To get single event details.
|
Events |
getEvents(java.util.Date since,
java.lang.Integer pageNo,
java.lang.Integer perPage)
Provides all the events from since date.
|
Facilities |
getFacilites(java.lang.Integer pageNo,
java.lang.Integer perPage)
Provides a listing of available datacenters where you can provision Packet devices.
|
Invitation |
getInvite(java.lang.String invitationId)
To get particular invite details.
|
IpAddress |
getIpAddress(java.lang.String ipAddressId)
To get particular IP Address details.
|
IpAddresses |
getIpAddresses(java.lang.String projectId)
To get all available IP Addresses form packet project.
|
Membership |
getMembership(java.lang.String membershipId)
To get project membership details.
|
Notification |
getNotification(java.lang.String notificationId)
To get single notification details.
|
Notifications |
getNotifications(java.util.Date since,
java.lang.Boolean all,
java.lang.Integer pageNo,
java.lang.Integer perPage)
To fetch all the notification from packet account.
|
OperatingSystems |
getOperatingSystems(java.lang.Integer pageNo,
java.lang.Integer perPage)
Provides a listing of available operating systems to provision your new device with.
|
Plans |
getPlans(java.lang.Integer pageNo,
java.lang.Integer perPage)
Provides a listing of available services plans available to provision your device on.
|
Project |
getProject(java.lang.String projectId)
Provides single project object.
|
Events |
getProjectEvents(java.lang.String projectId,
java.lang.Integer pageNo,
java.lang.Integer perPage)
To fetch all the events belongs to particular project.
|
Projects |
getProjects(java.lang.Integer pageNo,
java.lang.Integer perPage)
Projects are a way to group devices and grant users access to them.
|
SshKey |
getSshKey(java.lang.String sshKeyId)
To get single SSH key details.
|
SshKeys |
getSshKeys(java.lang.Integer pageNo,
java.lang.Integer perPage)
To get all the available SSH keys from packet account.
|
Transfer |
getTransferInfo(java.lang.String transferId)
Get the project transfer information.
|
User |
getUser(java.lang.String userId)
To get single user information.
|
Users |
getUsers(java.lang.Integer pageNo,
java.lang.Integer perPage)
To get all the available users information.
|
Invitation |
invite(java.lang.String projectId,
Invitation invitation)
Inviting a user to the project or adding user to the project.
|
java.lang.Boolean |
powerOffDevice(java.lang.String deviceId)
To turn-off power on your device.
|
java.lang.Boolean |
powerOnDevice(java.lang.String deviceId)
To power on your device.
|
java.lang.Boolean |
rebootDevice(java.lang.String deviceId)
To reboot device normally.
|
java.lang.Boolean |
rescueDevice(java.lang.String deviceId)
To reboot the device into rescue OS.
|
java.lang.Boolean |
reserveIpAddress(java.lang.String projectId,
ReserveIpAddress reserveIpAddress)
Reserve/Request more IP address for a project.
|
Transfer |
transferProject(java.lang.String projectId,
java.lang.String membershipId)
Project owners can transfer ownership of their projects to other members.
|
User |
updateCurrentUser(User user)
To update current user information.
|
Device |
updateDevice(Device device)
To update device details on packet project.
|
Email |
updateEmailAddress(Email email)
To update email address to default address or non-default.
|
Membership |
updateMembership(Membership membership)
To update membership details.
|
Notification |
updateNotification(Notification notification)
To update single notification.
|
Project |
updateProject(Project project)
Updates a project information.
|
SshKey |
updateSshKey(SshKey sshKey)
To update existing SSH key on packet account.
|
public PacketClient(java.lang.String authToken, java.lang.String version)
authToken
- authentication tokens from
Packet Portalversion
- API version numberpublic PacketClient(java.lang.String authToken, java.lang.String version, org.apache.http.impl.client.CloseableHttpClient httpClient)
authToken
- authentication tokens from
Packet Portalversion
- API version numberhttpClient
- Apache HTTP Client instancepublic Facilities getFacilites(java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getFacilites
in interface Packet
pageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Facilities
PacketException
- for HTTP status code >= 400 && < 510
public OperatingSystems getOperatingSystems(java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getOperatingSystems
in interface Packet
pageNo
- for paginationperPage
- no. of items per page (optional, can pass null)OperatingSystems
PacketException
- for HTTP status code >= 400 && < 510
public Plans getPlans(java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getPlans
in interface Packet
pageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Plans
PacketException
- for HTTP status code >= 400 && < 510
public Projects getProjects(java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException, HttpErrorException
Packet
getProjects
in interface Packet
pageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Projects
PacketException
- for HTTP status code >= 400 && < 510
HttpErrorException
public Project getProject(java.lang.String projectId) throws PacketException
Packet
getProject
in interface Packet
projectId
- a packet project idProject
PacketException
- for HTTP status code >= 400 && < 510
public Project createProject(Project project) throws PacketException
Packet
createProject
in interface Packet
project
- a Project
instanceProject
PacketException
- for HTTP status code >= 400 && < 510
public Project updateProject(Project project) throws PacketException
Packet
updateProject
in interface Packet
project
- a Project
instanceProject
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean deleteProject(java.lang.String projectId) throws PacketException
Packet
deleteProject
in interface Packet
projectId
- a packet project idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public Transfer transferProject(java.lang.String projectId, java.lang.String membershipId) throws PacketException
Packet
transferProject
in interface Packet
projectId
- a packet project idmembershipId
- a packet membership idTransfer
PacketException
- for HTTP status code >= 400 && < 510
public Transfer getTransferInfo(java.lang.String transferId) throws PacketException
Packet
getTransferInfo
in interface Packet
transferId
- project transfer idTransfer
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean acceptTransfer(java.lang.String transferId) throws PacketException
Packet
acceptTransfer
in interface Packet
transferId
- project transfer idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean declineTransfer(java.lang.String transferId) throws PacketException
Packet
declineTransfer
in interface Packet
transferId
- project transfer idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public Devices getDevices(java.lang.String projectId, java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getDevices
in interface Packet
projectId
- a packet project idpageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Devices
PacketException
- for HTTP status code >= 400 && < 510
public Device getDevice(java.lang.String deviceId) throws PacketException
Packet
getDevice
in interface Packet
deviceId
- a packet device idDevice
PacketException
- for HTTP status code >= 400 && < 510
public Device createDevice(java.lang.String projectId, Device device) throws PacketException
Packet
createDevice
in interface Packet
projectId
- a packet project iddevice
- a Device
instanceDevice
PacketException
- for HTTP status code >= 400 && < 510
public Device updateDevice(Device device) throws PacketException
Packet
updateDevice
in interface Packet
device
- a Device
instanceDevice
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean deleteDevice(java.lang.String deviceId) throws PacketException
Packet
deleteDevice
in interface Packet
deviceId
- a packet device idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean powerOnDevice(java.lang.String deviceId) throws PacketException
Packet
powerOnDevice
in interface Packet
deviceId
- a packet device idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean powerOffDevice(java.lang.String deviceId) throws PacketException
Packet
powerOffDevice
in interface Packet
deviceId
- a packet device idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean rebootDevice(java.lang.String deviceId) throws PacketException
Packet
rebootDevice
in interface Packet
deviceId
- a packet device idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean rescueDevice(java.lang.String deviceId) throws PacketException
Packet
rescueDevice
in interface Packet
deviceId
- a packet device idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public Metrics deviceTraffic(java.lang.String deviceId, TrafficDirection direction, java.util.Date timeframeStart, java.util.Date timeframeEnd) throws PacketException
Packet
deviceTraffic
in interface Packet
deviceId
- a packet device iddirection
- a value of TrafficDirection
timeframeStart
- a starting date timetimeframeEnd
- a end date timeMetrics
PacketException
- for HTTP status code >= 400 && < 510
public Metrics deviceTraffic(java.lang.String deviceId, TrafficDirection direction, java.util.Date timeframeStart, java.util.Date timeframeEnd, MetricInterval interval, TrafficBucket bucket) throws PacketException
Packet
deviceTraffic
in interface Packet
deviceId
- a packet device iddirection
- a value of TrafficDirection
timeframeStart
- a starting date timetimeframeEnd
- a end date timeinterval
- a value of MetricInterval
bucket
- a value of TrafficBucket
Metrics
PacketException
- for HTTP status code >= 400 && < 510
public IpAddresses getIpAddresses(java.lang.String projectId) throws PacketException
Packet
getIpAddresses
in interface Packet
projectId
- a packet project idIpAddresses
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean reserveIpAddress(java.lang.String projectId, ReserveIpAddress reserveIpAddress) throws PacketException
Packet
reserveIpAddress
in interface Packet
projectId
- a packet project idreserveIpAddress
- a instance of ReserveIpAddress
Boolean
PacketException
- for HTTP status code >= 400 && < 510
public IpAddress getIpAddress(java.lang.String ipAddressId) throws PacketException
Packet
getIpAddress
in interface Packet
ipAddressId
- id of the IP addressIpAddress
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean deleteIpAddress(java.lang.String ipAddressId) throws PacketException
Packet
deleteIpAddress
in interface Packet
ipAddressId
- id of the IP addressBoolean
PacketException
- for HTTP status code >= 400 && < 510
public Users getUsers(java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getUsers
in interface Packet
pageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Users
PacketException
- for HTTP status code >= 400 && < 510
public User getUser(java.lang.String userId) throws PacketException
Packet
getUser
in interface Packet
userId
- packet user idUser
PacketException
- for HTTP status code >= 400 && < 510
public User getCurrentUser() throws PacketException
Packet
getCurrentUser
in interface Packet
User
PacketException
- for HTTP status code >= 400 && < 510
public User updateCurrentUser(User user) throws PacketException
Packet
updateCurrentUser
in interface Packet
user
- a instance of User
User
PacketException
- for HTTP status code >= 400 && < 510
public Membership getMembership(java.lang.String membershipId) throws PacketException
Packet
getMembership
in interface Packet
membershipId
- project membership idMembership
PacketException
- for HTTP status code >= 400 && < 510
public Membership updateMembership(Membership membership) throws PacketException
Packet
updateMembership
in interface Packet
membership
- a instance of Membership
Membership
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean deleteMembership(java.lang.String membershipId) throws PacketException
Packet
deleteMembership
in interface Packet
membershipId
- project membership idBoolean
PacketException
- for HTTP status code >= 400 && < 510
public SshKeys getSshKeys(java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getSshKeys
in interface Packet
pageNo
- for paginationperPage
- no. of items per page (optional, can pass null)SshKeys
PacketException
- for HTTP status code >= 400 && < 510
public SshKey getSshKey(java.lang.String sshKeyId) throws PacketException
Packet
getSshKey
in interface Packet
sshKeyId
- id of the SSH keySshKey
PacketException
- for HTTP status code >= 400 && < 510
public SshKey createSshKey(SshKey sshKey) throws PacketException
Packet
createSshKey
in interface Packet
sshKey
- a instance of SshKey
SshKey
PacketException
- for HTTP status code >= 400 && < 510
public SshKey updateSshKey(SshKey sshKey) throws PacketException
Packet
updateSshKey
in interface Packet
sshKey
- a instance of SshKey
SshKey
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean deleteSshKey(java.lang.String sshKeyId) throws PacketException
Packet
deleteSshKey
in interface Packet
sshKeyId
- a instance of SshKey
Boolean
PacketException
- for HTTP status code >= 400 && < 510
public Invitation invite(java.lang.String projectId, Invitation invitation) throws PacketException
Packet
invite
in interface Packet
projectId
- a packet project idinvitation
- a instance of Invitation
Invitation
PacketException
- for HTTP status code >= 400 && < 510
public Invitation getInvite(java.lang.String invitationId) throws PacketException
Packet
getInvite
in interface Packet
invitationId
- a user invitation idInvitation
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean acceptInvite(java.lang.String invitationId) throws PacketException
Packet
acceptInvite
in interface Packet
invitationId
- a user invitation idInvitation
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean declineInvite(java.lang.String invitationId) throws PacketException
Packet
declineInvite
in interface Packet
invitationId
- a user invitation idInvitation
PacketException
- for HTTP status code >= 400 && < 510
public Events getEvents(java.util.Date since, java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getEvents
in interface Packet
since
- date time of events to fetchpageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Events
PacketException
- for HTTP status code >= 400 && < 510
public Events getProjectEvents(java.lang.String projectId, java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getProjectEvents
in interface Packet
projectId
- packet project idpageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Events
PacketException
- for HTTP status code >= 400 && < 510
public Events getDeviceEvents(java.lang.String deviceId, java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getDeviceEvents
in interface Packet
deviceId
- packet device idpageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Events
PacketException
- for HTTP status code >= 400 && < 510
public Event getEvent(java.lang.String eventId) throws PacketException
Packet
getEvent
in interface Packet
eventId
- id of project or device event idEvent
PacketException
- for HTTP status code >= 400 && < 510
public Notifications getNotifications(java.util.Date since, java.lang.Boolean all, java.lang.Integer pageNo, java.lang.Integer perPage) throws PacketException
Packet
getNotifications
in interface Packet
since
- date time of notifications to fetchall
- to include read notification toopageNo
- for paginationperPage
- no. of items per page (optional, can pass null)Notifications
PacketException
- for HTTP status code >= 400 && < 510
public Notification getNotification(java.lang.String notificationId) throws PacketException
Packet
getNotification
in interface Packet
notificationId
- id of the packet notificationsNotification
PacketException
- for HTTP status code >= 400 && < 510
public Notification updateNotification(Notification notification) throws PacketException
Packet
updateNotification
in interface Packet
notification
- a instance of the Notification
Notification
PacketException
- for HTTP status code >= 400 && < 510
public Email addEmailAddress(Email email) throws PacketException
Packet
addEmailAddress
in interface Packet
email
- a valid email addressEmail
PacketException
- for HTTP status code >= 400 && < 510
public Email getEmailAddress(java.lang.String emailId) throws PacketException
Packet
getEmailAddress
in interface Packet
emailId
- id of the email address recordEmail
PacketException
- for HTTP status code >= 400 && < 510
public Email updateEmailAddress(Email email) throws PacketException
Packet
updateEmailAddress
in interface Packet
email
- a instance of Email
Email
PacketException
- for HTTP status code >= 400 && < 510
public java.lang.Boolean deleteEmailAddress(java.lang.String emailId) throws PacketException
Packet
deleteEmailAddress
in interface Packet
emailId
- id of the email address recordBoolean
PacketException
- for HTTP status code >= 400 && < 510