Skip to content

Commit

Permalink
Update documentation. Closes sous-chefs#90
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Baptiste Favre committed Oct 6, 2015
1 parent 04cd530 commit c314004
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,14 @@ This resource will allow you to create global users within Grafana. This resourc
More information about creating Grafana users via the HTTP API can be found [here](http://docs.grafana.org/reference/http_api/#users).

#### Attributes
| Attribute | Type | Default Value | Description |
|----------------|:--------:|:-------------------:|-----------------------------------|
| `host` | `String` | `'localhost'` | The host grafana is running on |
| `port` | `Integer`| `3000` | The port grafana is running on |
| `user` | `String` | `'admin'` | A grafana user with admin privileges |
| `password` | `String` | `'admin'` | The grafana user's password |
| Attribute | Type | Default Value | Description |
|----------------|:--------:|:-------------------:|----------------------------------------------------------|
| `host` | `String` | `'localhost'` | The host grafana is running on |
| `port` | `Integer`| `3000` | The port grafana is running on |
| `admin_user` | `String` | `'admin'` | A grafana user with admin privileges |
| `adminpassword`| `String` | `'admin'` | The grafana user's password |
| `user` | `Hash ` | `{}` | A Hash of the values to create the user. Examples below. |

| `global` | `boolean`| `true` | Whether you want the user to be a global user. _Currently only global `true` is supported._ |
| `admin` | `boolean`| `false` | Whether or not the user should be a global admin. _Currently only admin `false` is supported._ |
| `login` | `String` | | The login for this user. Defaults to the name used in the resource invocation. |
Expand All @@ -226,10 +228,48 @@ More information about creating Grafana users via the HTTP API can be found [her
Assuming you would like to create a new user...

```ruby
grafana_user 'person2' do
full_name 'John Smith'
email 'test@example.com'
passwd 'test123'
grafana_user 'j.smith' do
user(
name: 'John Smith',
email: 'test@example.com',
password: 'test123',
isAdmin: true
)
action :create
end
```
User's login property is not mandatory. DEfault goes to resource name.

To update user's details, password and permissions
```ruby
grafana_user 'j.smith' do
user(
name: 'John Smith',
email: 'test@example.com',
password: 'test1234',
isAdmin: false
)
action :update
end
```

To update user's login, use current login as resource name and new login as user property, like:
```ruby
grafana_user 'j.smith' do
user(
name: 'John Smith',
login: 'john.smith',
email: 'test@example.com',
password: 'test1234',
isAdmin: false
)
action :update
end
```
And finally to delete a user
```ruby
grafana_user 'john.smith' do
action :delete
end
```

Expand Down

0 comments on commit c314004

Please sign in to comment.