Commit Graph

235 Commits

Author SHA1 Message Date
dependabot[bot]
e1fe310f6d Bump github.com/hashicorp/go-version from 1.3.0 to 1.4.0 (#58)
Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/hashicorp/go-version/releases)
- [Changelog](https://github.com/hashicorp/go-version/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/go-version/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-version
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-06 12:33:34 +11:00
dependabot[bot]
1ad6a13fab Bump golang.org/x/tools from 0.1.7 to 0.1.8 (#56)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.7 to 0.1.8.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.7...v0.1.8)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-21 11:45:47 +11:00
Paul Tyng
bb319b44af Fix generate to use tool 2021-11-21 10:56:54 -05:00
dependabot[bot]
3d8a23e785 Bump golang.org/x/tools from 0.1.6 to 0.1.7 (#51)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.6 to 0.1.7.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.6...v0.1.7)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 09:48:10 +10:00
Joshua Spence
ff2854e943 Implement Stringer interface for DeviceState (#49)
* Implement `Stringer` interface for `DeviceState`

If device adoption fails the error message isn't very readable at the moment.

```
Error: unexpected state '10', wanted target '2'.
```

* Use `stringer`
2021-09-24 13:55:12 +10:00
Joshua Spence
124f349da4 Format generated golang with go/format (#48) 2021-09-24 13:17:25 +10:00
Joshua Spence
8d4ca5f389 Revert "Add controller version to generated files" (#47)
This reverts commit 13d5677bf3.
2021-09-24 07:21:34 +10:00
Joshua Spence
7d87194aef Update to latest controller version (#46)
* Update to latest controller version

* Fix tests
2021-09-21 23:26:12 +10:00
Joshua Spence
0cb7d3e514 Add AdoptDevice and ForgetDevice methods (#45)
* Add `AdoptDevice` and `ForgetDevice` methods

* Address comments
2021-09-17 11:16:56 +10:00
Paul Tyng
13d5677bf3 Add controller version to generated files 2021-08-31 09:02:23 -04:00
Johannes Heck
4e9d935af2 fix Ht fieldType for device import 2021-08-18 16:10:47 -04:00
Joshua Spence
a9d0f1de5a Use --latest 2021-08-11 11:40:15 +10:00
Joshua Spence
e27afc6e32 Add --latest flag
Allow using the latest version of the Unifi controller with `--latest`.
2021-08-11 11:40:15 +10:00
Joshua Spence
8f8e19eb2a Don't commit intermediate files
Don't commit the extracted JSON files as well only need the generated `*.generated.go` files.
2021-08-11 11:40:15 +10:00
dependabot[bot]
7ebb3b204f Bump github.com/iancoleman/strcase from 0.1.3 to 0.2.0 (#42)
Bumps [github.com/iancoleman/strcase](https://github.com/iancoleman/strcase) from 0.1.3 to 0.2.0.
- [Release notes](https://github.com/iancoleman/strcase/releases)
- [Commits](https://github.com/iancoleman/strcase/compare/v0.1.3...v0.2.0)

---
updated-dependencies:
- dependency-name: github.com/iancoleman/strcase
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 09:32:12 +10:00
Kurt McAlpine
7081791f4f Export fields on SettingMgmtXSshKeys (#41) 2021-07-05 14:51:44 +10:00
Joshua Spence
f06d3401ae Run go generate 2021-06-29 17:43:00 -04:00
Joshua Spence
510bd417c2 Add generate job 2021-06-29 17:43:00 -04:00
Joshua Spence
693795b5f0 Fix failing test 2021-06-29 17:43:00 -04:00
Joshua Spence
64a73cdd4b Fix linter issues 2021-06-29 17:43:00 -04:00
Joshua Spence
496fcdf07c Add GitHub Actions 2021-06-29 17:43:00 -04:00
Joshua Spence
0f7cae7373 Mark generated files
Hide generated files from diffs in the GitHub UI (see https://docs.github.com/en/github/administering-a-repository/managing-repository-settings/customizing-how-changed-files-appear-on-github).
2021-06-29 17:40:41 -04:00
Joshua Spence
2f7eee3a6a Add dev_id_override to user 2021-06-18 15:39:41 -04:00
Joshua Spence
dd685c0447 Fix type of x_ssh_keys
The `unifi_settings_mgmt` resource fails for me with the following error:

```
Error: unable to decode body: GET s/default/get/setting/mgmt unable to unmarshal alias: json: cannot unmarshal object into Go struct field .x_ssh_keys of type string
```

My `x_ssh_keys` looks like this:

```
[
  {
    "name": "Laptop",
    "type": "ssh-rsa",
    "key": "REDACTED",
    "comment": "REDACTED",
    "date": "2021-02-25T08:26:04Z",
    "fingerprint": "REDACTED"
  }
]
```
2021-06-16 09:28:49 -04:00
James Stephenson
fbed685c37 Fixing unmarshalling of numberOrString
New unmarshalling rules for fields which could be numeric or string
values were not properly typecasted upon being deserialized.

Cleaned up the api template file and moved custom unmarshalling type
logic into go code out of the template.
2021-04-16 13:41:01 -04:00
Paul Tyng
4ab4036985 Bump to 6.0.43, use go generate
Also moved fetching of JSON information to Go for cross-OS usage.
2021-04-09 09:51:50 -04:00
Paul Tyng
5219e06753 Remove old field JSON 2021-04-09 09:51:50 -04:00
Kurt McAlpine
bd8898db77 Set d.Key for all settings updates 2021-04-09 09:51:50 -04:00
Kurt McAlpine
ac8d0c5659 Set key to mgmt for updateSettingMgmt api 2021-04-05 10:40:43 -04:00
Kurt McAlpine
74e2b9dd38 Add GetSettingMgmt and UpdateSettingMgmt functions 2021-03-31 08:05:44 -04:00
Paul Tyng
0c90e4c32e Add dynamic DNS support 2021-03-28 14:41:48 -04:00
Paul Tyng
9e8fe73b85 Return wrapped APIError 2021-03-23 08:50:01 -04:00
Paul Tyng
4702e34c81 Fix unmarshalling of tx_power 2021-03-21 21:34:29 -04:00
Paul Tyng
a3d437ef8e Remove generated AP group for now 2021-03-21 21:20:44 -04:00
Paul Tyng
82a3baaf00 Handle marshaling of numbers and strings for channels 2021-03-21 21:13:58 -04:00
Paul Tyng
9c60a9de6f Change to string for auto support 2021-03-20 11:30:10 -04:00
Paul Tyng
3eb04af6a7 Fix issue with status not returning controller version on 6.0.43 2021-03-07 11:00:18 -05:00
Paul Tyng
23f4659d36 Fix AP group access on API proxy 2021-03-07 10:59:52 -05:00
Patrick Collins
c55b43115b login before checking status
the status enpoint requires auth, at least in my Cloud Key Firmware 2.X
(UniFi OS) setup.
Presumably there are benefits to checking status before logging in; in
which case I expect this PR will need to be edited.
2021-01-31 15:27:53 -05:00
dependabot[bot]
b5c55d88f4 Bump github.com/iancoleman/strcase from 0.1.2 to 0.1.3
Bumps [github.com/iancoleman/strcase](https://github.com/iancoleman/strcase) from 0.1.2 to 0.1.3.
- [Release notes](https://github.com/iancoleman/strcase/releases)
- [Commits](https://github.com/iancoleman/strcase/compare/v0.1.2...v0.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-15 09:11:15 -05:00
dependabot[bot]
1aff93dbbb Bump github.com/stretchr/testify from 1.6.1 to 1.7.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-14 14:22:49 -05:00
Hendrik "T4cC0re" Meyer
4aed7d703d Generate UnmarshalJSON to handle emptyStringInt types
This commit changes the code generator to generate a `UnmarshalJSON` for each
struct, so that if unmarshalled it properly handles UniFis varying integer values
via the `emptyStringInt` type.

Structs not including a field of `int` type will still have the function generated,
but it will effectively do nothing.

Fixes #18
2021-01-03 13:21:53 -05:00
Paul Tyng
c5ff8c8593 Allow unmarshalling of string for rule index 2020-12-01 12:31:29 -05:00
Paul Tyng
54b85782ca Cleanup mod 2020-12-01 12:31:12 -05:00
Russell Parks
55b1bac0bc Fix /status for UDMP (#17) 2020-11-02 13:15:08 -05:00
Paul Tyng
abc676f62b Add support for 6.0.23 2020-10-20 10:10:32 -04:00
John Losito
020dad41e7 Allow dependabot to check go modules daily 2020-10-20 08:44:46 -04:00
Kurt McAlpine
d14cec1fad Add method to get site 2020-10-13 09:08:26 -04:00
Kurt McAlpine
cb425568b4 Add method to update site 2020-10-13 09:08:26 -04:00
Kurt McAlpine
d6dded588f Add method to delete site 2020-10-13 09:08:26 -04:00