You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/quota-management/README.md
+36-23Lines changed: 36 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,47 @@
1
-
# Quota Management example
1
+
# Managing the device's quota data with the emnify Java SDK
2
2
3
-
This example shows how to manage endpoint's quota data.
3
+
This example shows how to manage the device's quota data.
4
4
5
-
1. Script authorizes the client using configured credentials.
6
-
2. The list of endpoints is fetched then a first endpoint is taken to work with.
7
-
3. Then check the current state of quota
8
-
4. Script configures a quota with the following data:
9
-
- set new volume of 10MB
10
-
- the quota expires in 7 days
11
-
- a threshold is set to 15%. If the remaining volume goes below this percentage of the applied quota, the system
12
-
will generate a "threshold reached" event.
13
-
- the action of exhaustion is configured to Throttle with a peak throughput of 64000 octets per second
14
-
5. Script fetches the quota data to check if configuration has been saved successfully
5
+
Here's a high-level overview of what happens in the script:
6
+
7
+
1. Authorizes the client using configured credentials
8
+
1. Fetches a list of devices and selects the first device
9
+
1. Checks the current state of the quota
10
+
1. Configures a new quota with the following settings:
11
+
- 10 MB of volume
12
+
- Expires in 7 days
13
+
- 15% threshold
14
+
- If the remaining volume goes below this percentage of the applied quota, the system will generate a [Quota threshold reached event](https://docs.emnify.com/services/events/event-types#quota-threshold-reached)
15
+
- Exhaustion action is "Throttle" with a peak throughput of 64000 octets per second
16
+
1. Fetches the quota settings to check if the configuration has been saved successfully
15
17
16
18
## Running the example
17
19
18
-
Firstly, follow the [SDK installation](../../README.md#Installation) instruction.
20
+
### Install the SDK
21
+
22
+
<!-- TODO: Replace relative path with link to docs.emnify.com when live -->
23
+
First, follow the [SDK installation instructions](../../README.md#Installation).
24
+
25
+
### Configure authorization credentials
26
+
27
+
Next, you need to configure your authorization credentials.
28
+
There are two ways to do this:
29
+
30
+
#### Application token
19
31
20
-
Then you need to configure you authorization credentials. There are two options:
32
+
<!-- TODO: Replace relative path with link to docs.emnify.com when live -->
33
+
To [authenticate via application token](https://cdn.emnify.net/api/doc/application-token.html), you need to add `EMNIFY_APPLICATION_TOKEN` as an [environment variable](../../README.md#environment-variables).
21
34
22
-
#### Application Token
23
-
If you want to authenticate via application token, you need to add system environment `EMNIFY_APPLICATION_TOKEN`. <ahref="https://cdn.emnify.net/api/doc/application-token.html"target="_blank">Read more about Application Token</a>.
35
+
#### User authentication
24
36
25
-
#### User Authentication
37
+
<!-- TODO: Replace relative path with link to docs.emnify.com when live -->
38
+
If you want to [authenticate via user authentication](https://cdn.emnify.net/api/doc/basic-auth.html), you need to add the `EMNIFY_USERNAME` and `EMNIFY_PASSWORD`[environment variables](../../README.md#environment-variables).
26
39
27
-
If you want to authenticate via user authentication, you need to add environments `EMNIFY_USERNAME` and `EMNIFY_PASSWORD`. <ahref="https://cdn.emnify.net/api/doc/basic-auth.html"target="_blank">Read more about User Authentication</a>.
40
+
### Execute the example
28
41
29
-
Configure one of the authentication described above and execute example.
42
+
After configuring one of the authentication methods described in the previous section, you can execute the example.
30
43
31
-
OR just run via terminal:
44
+
Here's how to run it in the terminal using [Maven](https://maven.apache.org/download.cgi):
0 commit comments