Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Enhancements to docs for consistent examples of both PowerShell and bash#133

Open
peterbom wants to merge 6 commits into
Azure:developfrom
peterbom:feature/sestest-docs
Open

Enhancements to docs for consistent examples of both PowerShell and bash#133
peterbom wants to merge 6 commits into
Azure:developfrom
peterbom:feature/sestest-docs

Conversation

@peterbom
Copy link
Copy Markdown
Contributor

@peterbom peterbom commented Mar 4, 2019

Most of the walk-through (and related documents, build-guide and finding-certificates) give example commands only in PowerShell.

I added some bash examples when doing the work on the leasing API, but there was no obvious way to go through the entire walk-through (particularly building sestest, running the test server, and generating certificates) without using some PowerShell, making the bash examples somewhat redundant.

This adds a bash "wrapper" for sestest, equivalent to sestest.ps1, making it easier to run the test server and generate certificates in bash, and uses this throughout the walk-through.

I've also experimented with swapping the "generating a token" and "starting the test server" sections to reduce the required number of switches between shell windows, and keep the "client-side" commands (generating and verifying tokens) all in one place. I find this makes the document easier to read, but it's done as separate commits so it's easy to back out if preferred.

Comment thread docs/build-guide.md
Comment thread docs/walk-through.md
You should now have the following variables defined:
- `AZ_BATCH_SOFTWARE_ENTITLEMENT_TOKEN`
- `AZ_BATCH_ACCOUNT_URL`
- `applicationId`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to call out that the first two are environment variables and the last one is a shell variable?

Comment thread docs/walk-through.md
"expiry": "2019-01-16T01:06:07+00:00"
}
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a snippet to quantify the similarity/difference.

Perhaps

The actual id value and expiry timestamp will differ, but the structure will be the same.

??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added descriptive comments to the fields themselves.

Comment thread docs/walk-through.md
$AZ_BATCH_ACCOUNT_URL/softwareEntitlements?api-version=$apiVersion \
$AZ_BATCH_ACCOUNT_URL/softwareEntitlements?api-version=9999-09-09.99.99 \
| jq -re '.entitlementId' || (echo "FAILED: entitlementId not found in JSON response" 1>&2))
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to precede these with examples showing the actual response from the server before showing the slice/dice of these as they extract the entitlementId.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree it'd be informative and consistent to include the server response. I wasn't certain how to do so while:

  • Only documenting the bulk of the request (Invoke-RestMethod or curl) once, to reduce clutter and ease maintenance
  • Providing a minimal set of commands (as few as possible) for the user to cut and paste (i.e. I'd prefer to avoid two separate commands for storing the server response and parsing out the entitlement id)

How about this approach? I've kept the commands unchanged, but added a description of what the response content looks like (before the entitlementId is extracted out).

Comment thread docs/walk-through.md
@@ -287,79 +342,38 @@ $ curl \
--silent \
--header "Content-Type: application/json; odata=minimalmetadata" \
--data "{'duration':'PT5M'}" \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include a link to the REST API documentation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where's the (public) REST API documentation?

@theunrepentantgeek
Copy link
Copy Markdown
Member

This has come together really well.

Comment thread docs/walk-through.md
```json
{
"id": "entitlement-695c822b-470c-4fd1-b34d-9b21435f57b2", // every entitlement has a unique identifier
"expiry": "2019-01-16T01:06:07+00:00" // reflects the expiry of the token, so all requests passing the same token will have the same expiry
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably remove this in a subsequent PR. Returning the expiry value is part of the pre-leasing "V2" API which was never deployed in production.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants