Skip to content

Commit 2012175

Browse files
committed
Update Blog “hpe-greenlake-edge-to-cloud-platform-scripting-fundamentals”
1 parent d3f9f8d commit 2012175

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content/blog/hpe-greenlake-edge-to-cloud-platform-scripting-fundamentals.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: HPE GreenLake edge-to-cloud platform scripting fundamentals
2+
title: HPE GreenLake cloud scripting fundamentals
33
date: 2024-01-24T09:51:57.270Z
44
featuredBlog: false
55
priority: 15
@@ -111,13 +111,13 @@ The response provides an access token of type “Bearer” with a time to live o
111111
According to the [API Reference documentation](https://developer.greenlake.hpe.com/docs/greenlake/services/audit-logs/public/) for the Audit Log service, I can query the log using:
112112

113113
```markdown
114-
GET /audit-log/v1beta1/logs
114+
GET /audit-log/v1/logs
115115
```
116116

117117
I can also see from the documentation, that I can use a filter to keep only logs after a certain date using the following parameter: 
118118

119119
```markdown
120-
GET /audit-log/v1beta1/logs?filter=createdAt ge '2023-07-24T04:21:22.00Z'
120+
GET /audit-log/v1/logs?filter=createdAt ge '2023-07-24T04:21:22.00Z'
121121
```
122122

123123
> > *Note: the format of the date used by the API, which is [ISO 8601](https://www.iso.org/standard/70908.html) of the form: YYYY-MM-DDTHH:MM:SS.ss-/+FF:ff. For example: '2023-07-24T04:21:22.00Z' for 4:21AM on the 24th of July, 2023 in UTC (Z=Zero Meridian)* 
@@ -235,7 +235,7 @@ do 
235235
I can now call the API with the right authorization header and set the filter parameter, **startTime** greater than the computed date: 
236236
237237
```shell
238-
http_response=$(curl -s -o out.json -w "%{http_code}" --location "https://global.api.greenlake.hpe.com/audit-log/v1beta1/logs?filter=startTime%20ge%20'$d'"
238+
http_response=$(curl -s -o out.json -w "%{http_code}" --location "https://global.api.greenlake.hpe.com/audit-log/v1/logs?filter=startTime%20ge%20'$d'"
239239
--header 'Accept: application/json'
240240
--header "Authorization: $access_token")
241241
```
@@ -371,7 +371,7 @@ Here, you’ll see that I can leverage exceptions that PowerShell supports: 
371371
372372
```powershell
373373
    try { 
374-
        $response = Invoke-webrequest "https://global.api.greenlake.hpe.com/audit-log/v1beta1/logs?filter=startTime%20ge%20'$sd'" -Method GET -Headers $headers  
374+
        $response = Invoke-webrequest "https://global.api.greenlake.hpe.com/audit-log/v1/logs?filter=startTime%20ge%20'$sd'" -Method GET -Headers $headers  
375375
    } 
376376
    catch { 
377377
        write-host "Error calling the API or token has expired!" 
@@ -498,7 +498,7 @@ my_headers = { 
498498
        'accept': 'application/json'
499499
        'Authorization': my_token, 
500500
    } 
501-
    my_url = "https://global.api.greenlake.hpe.com/audit-log/v1beta1/logs?filter=startTime%20ge%20'" + date + "'" 
501+
    my_url = "https://global.api.greenlake.hpe.com/audit-log/v1/logs?filter=startTime%20ge%20'" + date + "'" 
502502

503503
# Fetch audit logs since last minute 
504504
    response = requests.get(url=my_url, headers=my_headers) 

0 commit comments

Comments
 (0)