Skip to content

Commit b72a0ae

Browse files
authored
Update SDK documentation (#12)
1 parent 6ea480b commit b72a0ae

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ A CloudStack API client enabling Go programs to interact with CloudStack in a si
66

77
## Status
88

9-
This package covers the complete CloudStack API and is well tested. Of course there will still be untested corner cases when you have over 400 API commands that you can use, but over all it's safe to use this package.
9+
This package covers the complete CloudStack API and is well tested. There may be some untested corner cases as there are over 600 API commands, but over all, it's safe to use this package.
1010

1111
To be able to find the API command you want, they are grouped by 'services' which match the grouping you can see/find on the [CloudStack API docs](https://cloudstack.apache.org/api/apidocs-4.15/) website.
1212

1313
## Usage
1414

15-
The cloudstack package is always generated against the latest stable CloudStack release (currently v4.15.x). Luckily the API doesn't change that much, and were it does we try to make sure the generated package is able handle both the old and the new case. Over time it will be impossible to support all version with just one package, but until now we seem to manage this pretty well.
15+
The cloudstack package is always generated against the latest stable CloudStack release (currently v4.15.x). As long as the API changes were minimum across subsequent CloudStack releases it was possible to have the generator code handle API changes such that they were backward compatible.
16+
However, over time, with frequent API changes observed across releases of Apache CloudStack(ACS), we will have the SDK releases tagged based on the ACS version.
1617

1718
Please see the package documentation on [go.dev](https://pkg.go.dev/github.com/apache/cloudstack-go/v2/cloudstack).
1819

@@ -40,22 +41,33 @@ if err != nil {
4041
log.Fatalf("Error creating the new instance %s: %s", name, err)
4142
}
4243

43-
fmt.Printf("UUID or the newly created machine: %s", r.ID)
44+
fmt.Printf("UUID or the newly created machine: %s", r.Id)
4445
```
4546

4647
## Features
4748

48-
Next to the API commands CloudStack itself offers, there are a few additional features/function that are helpful. For starters there are two clients, an normal one (created with `NewClient(...)`) and an async client (created with `NewAsyncClient(...)`). The async client has a buildin waiting/polling feature that waits for a configured amount of time (defaults to 300 seconds) on running async jobs. This is very helpfull if you do not want to continue with your program execution until the async job is done.
49+
Apart from the API commands CloudStack itself offers, there are a few additional features/functions that are helpful. For starters, there are two clients, a normal one (created with `NewClient(...)`) and an async client (created with `NewAsyncClient(...)`). The async client has a builtin waiting/polling feature that waits for a configured amount of time (defaults to 300 seconds) on running async jobs. This is very helpful if you do not want to continue with your program execution until the async job is done.
4950

50-
There is also a function you can call manually (`GetAsyncJobResult(...)`) that does the same, but then as a seperate call after you started the async job.
51+
There is also a function that can be called manually (`GetAsyncJobResult(...)`) that does the same, but then as a separate call after the async job has started.
5152

52-
Another nice feature is the fact that for every API command you can create the needed parameter struct using a `New...Params` function, like for example `NewListTemplatesParams`. The advantage of using this functions to create a new parameter struct, is that these functions know what the required parameters are of ever API command, and they require you to supply these when creating the new struct. Every additional paramater can be set after creating the struct by using `SetName()` like functions.
53+
Another nice feature is the fact that for every API command you can create the needed parameter struct using a `New...Params` function, like for example `NewListTemplatesParams`. The advantage of using this functions to create a new parameter struct, is that these functions know what the required parameters are for every API command, and they require you to supply these when creating the new struct. Every additional parameter can be set after creating the struct by using the appropriate setters, e.g., `SetName()`.
5354

54-
Last but not least there are a whole lot of helper function that will try to automatically find an UUID for you for a certain item (disk, template, virtualmachine, network...). This makes it much easier and faster to work with the API commands and in most cases you can just use then if you know the name instead of the UUID.
55+
Last but not the least, there are a lot of helper functions that will try to automatically find a UUID for you for various resources (disk, template, virtualmachine, network...). This makes it much easier and faster to work with the API commands and in most cases you can just use then if you know the name instead of the UUID.
5556

56-
## ToDo
57+
## Developer Guide
5758

58-
I fully understand I need to document this all a little more/better and there should also be some tests added.
59+
The SDK relies on the `generate.go` script to auto generate the code for all the supported APIs listed in the `listApis.json` file.
60+
The `listAPIs.json` file holds the output of `listApis` command for a specific release of CloudStack.
61+
62+
```
63+
# Build the generate.go script
64+
cd generate/
65+
go build
66+
67+
# Run the generator to auto-generate the code
68+
./generate -api listApis.json
69+
70+
```
5971

6072
## Getting Help
6173

0 commit comments

Comments
 (0)