Skip to content

Commit

Permalink
Merge pull request #96 from circonus-labs/CIRC-8503
Browse files Browse the repository at this point in the history
CIRC-8503: Implement changes to dashboard defaulting process
  • Loading branch information
dhaifley committed Jun 7, 2022
2 parents 533bed7 + 4d37489 commit 2e3886f
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 108 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
stable: true
go-version: 1.17.x
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3.2.0
with:
version: v1.42
skip-go-installation: true
args: --timeout=5m
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,11 @@ linters:
- gocognit
- cyclop
- exhaustive
- exhaustivestruct
- exhaustruct
- nestif
# re-enable
- maintidx
- wsl
- stylecheck
- goerr113
Expand All @@ -673,6 +676,8 @@ linters:
- dupl
- gochecknoinits
- goconst
- nonamedreturns
- varnamelen
# presets:
# - bugs
# - unused
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## 0.12.9 (June 6, 2022)

CHANGES:

* add: Adds the `default_dashboard_uuid` and `default_dashboard_type`
attributes to the Account data source schema to support the new changes to
the dashboard defaulting process.
* upd: Removes the `account_default` attribute from the Dashboard resource
schema to reflect the changes to the dashboard defaulting process since this
field is no longer returned by the API.

UPDATES:

* upd: Updates the version of go-apiclient to v0.7.16.

## 0.12.8 (June 6, 2022)

UPDATES:

* upd: Bumps github.com/hashicorp/terraform-plugin-sdk/v2 from 2.16.0 to 2.17.0.

## 0.12.7 (June 1, 2022)

IMPROVEMENTS:
Expand Down
76 changes: 49 additions & 27 deletions circonus/data_source_circonus_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,40 @@ import (
)

const (
accountAddress1Attr = "address1"
accountAddress2Attr = "address2"
accountCCEmailAttr = "cc_email"
accountCityAttr = "city"
accountContactGroupsAttr = "contact_groups"
accountCountryAttr = "country"
accountCurrentAttr = "current"
accountDescriptionAttr = "description"
accountEmailAttr = "email"
accountIDAttr = "id"
accountInvitesAttr = "invites"
accountLimitAttr = "limit"
accountNameAttr = "name"
accountOwnerAttr = "owner"
accountRoleAttr = "role"
accountStateProvAttr = "state"
accountTimezoneAttr = "timezone"
accountTypeAttr = "type"
accountUIBaseURLAttr = "ui_base_url"
accountUsageAttr = "usage"
accountUsedAttr = "used"
accountUserIDAttr = "id"
accountUsersAttr = "users"
accountAddress1Attr = "address1"
accountAddress2Attr = "address2"
accountCCEmailAttr = "cc_email"
accountCityAttr = "city"
accountContactGroupsAttr = "contact_groups"
accountCountryAttr = "country"
accountCurrentAttr = "current"
accountDefaultDashboardUUIDAttr = "default_dashboard_uuid"
accountDefaultDashboardTypeAttr = "default_dashboard_type"
accountDescriptionAttr = "description"
accountEmailAttr = "email"
accountIDAttr = "id"
accountInvitesAttr = "invites"
accountLimitAttr = "limit"
accountNameAttr = "name"
accountOwnerAttr = "owner"
accountRoleAttr = "role"
accountStateProvAttr = "state"
accountTimezoneAttr = "timezone"
accountTypeAttr = "type"
accountUIBaseURLAttr = "ui_base_url"
accountUsageAttr = "usage"
accountUsedAttr = "used"
accountUserIDAttr = "id"
accountUsersAttr = "users"
)

var accountDescription = map[schemaAttr]string{
accountContactGroupsAttr: "Contact Groups in this account",
accountInvitesAttr: "Outstanding invites attached to the account",
accountUsageAttr: "Account's usage limits",
accountUsersAttr: "Users attached to this account",
accountContactGroupsAttr: "Contact Groups in this account",
accountInvitesAttr: "Outstanding invites attached to the account",
accountUsageAttr: "Account's usage limits",
accountUsersAttr: "Users attached to this account",
accountDefaultDashboardUUIDAttr: "The UUID of the dashboard resource used as a default dashboard by this account",
accountDefaultDashboardTypeAttr: "The type of dashboard used as a default dashboard by this account",
}

func dataSourceCirconusAccount() *schema.Resource {
Expand Down Expand Up @@ -143,6 +147,18 @@ func dataSourceCirconusAccount() *schema.Resource {
Computed: true,
Description: accountDescription[accountCountryAttr],
},
// default_dashboard_uuid
accountDefaultDashboardUUIDAttr: {
Type: schema.TypeString,
Computed: true,
Description: accountDescription[accountDefaultDashboardUUIDAttr],
},
// default_dashboard_type
accountDefaultDashboardTypeAttr: {
Type: schema.TypeString,
Computed: true,
Description: accountDescription[accountDefaultDashboardTypeAttr],
},
// description
accountDescriptionAttr: {
Type: schema.TypeString,
Expand Down Expand Up @@ -273,6 +289,12 @@ func dataSourceCirconusAccountRead(ctx context.Context, d *schema.ResourceData,
if err := d.Set(accountCountryAttr, acct.Country); err != nil {
return diag.FromErr(err)
}
if err := d.Set(accountDefaultDashboardUUIDAttr, acct.DefaultDashboardUUID); err != nil {
return diag.FromErr(err)
}
if err := d.Set(accountDefaultDashboardTypeAttr, acct.DefaultDashboardType); err != nil {
return diag.FromErr(err)
}
if err := d.Set(accountDescriptionAttr, acct.Description); err != nil {
return diag.FromErr(err)
}
Expand Down
1 change: 0 additions & 1 deletion circonus/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func init() {
if testAccContactGroup3 = os.Getenv("CIRCONUS_TEST_CONTACT_GROUP_3"); testAccContactGroup3 == "" {
testAccContactGroup3 = "/contact_group/4680"
}

}

func TestProvider(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion circonus/resource_circonus_check_snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (
)

var checkSNMPDescriptions = attrDescrs{

checkSNMPAuthPassphrase: "The authentication passphrase to use. Only applicaable to SNMP Version 3.",
checkSNMPAuthProtocol: "The authentication protocol to use. Only applicaable to SNMP Version 3.",
checkSNMPCommunity: "The SNMP community string providing read access.",
Expand Down
9 changes: 0 additions & 9 deletions circonus/resource_circonus_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ func resourceDashboard() *schema.Resource {
Optional: true,
Default: false,
},
"account_default": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"grid_layout": {
Type: schema.TypeMap,
Required: true,
Expand Down Expand Up @@ -868,7 +863,6 @@ func dashboardRead(d *schema.ResourceData, meta interface{}) error {
gridLayoutAttrs["width"] = dash.GridLayout.Width
gridLayoutAttrs["height"] = dash.GridLayout.Height
_ = d.Set("grid_layout", gridLayoutAttrs)
_ = d.Set("account_default", dash.AccountDefault)
_ = d.Set("shared", dash.Shared)
_ = d.Set("title", dash.Title)
_ = d.Set("uuid", dash.UUID)
Expand Down Expand Up @@ -939,9 +933,6 @@ func (dash *circonusDashboard) ParseConfig(d *schema.ResourceData) error {
if v, found := d.GetOk("shared"); found {
dash.Shared = v.(bool)
}
if v, found := d.GetOk("account_default"); found {
dash.AccountDefault = v.(bool)
}

if v, found := d.GetOk("grid_layout"); found {
listRaw := v.(map[string]interface{})
Expand Down
6 changes: 4 additions & 2 deletions circonus/resource_circonus_rule_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,10 @@ func ruleSetRead(ctx context.Context, d *schema.ResourceData, meta interface{})
}

if err = d.Set(ruleSetIfAttr, ifRules); err != nil {
s, _ := json.MarshalIndent(ifRules, "", " ")
log.Printf("%s", s)
if s, errM := json.MarshalIndent(ifRules, "", " "); errM == nil {
log.Printf("%s", s)
}

return diag.FromErr(err)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/circonus-labs/terraform-provider-circonus

require (
github.com/circonus-labs/go-apiclient v0.7.15
github.com/circonus-labs/go-apiclient v0.7.16
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/circonus-labs/go-apiclient v0.7.15 h1:r9sUdc+EDM0tL6Z6u03dac8fxYvlz1kPhxlNwkoIoqM=
github.com/circonus-labs/go-apiclient v0.7.15/go.mod h1:RFgkvdYEkimzgu3V2vVYlS1bitjOz1SF6uw109ieNeY=
github.com/circonus-labs/go-apiclient v0.7.16 h1:PZ0i+/3y/NqmNdeIODzXj2NWj0lpsSOmoEzWKPcKsmo=
github.com/circonus-labs/go-apiclient v0.7.16/go.mod h1:BataHD4iEisUny8af+nmvXDtMittjnv8iNMpb81s/2k=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -117,8 +117,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ=
github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
github.com/hashicorp/go-retryablehttp v0.6.8 h1:92lWxgpa+fF3FozM4B3UZtHZMJX8T5XT+TFdCxsPyWs=
github.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ=
github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
Expand Down
7 changes: 7 additions & 0 deletions vendor/github.com/circonus-labs/go-apiclient/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 18 additions & 16 deletions vendor/github.com/circonus-labs/go-apiclient/account.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions vendor/github.com/circonus-labs/go-apiclient/dashboard.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/circonus-labs/go-apiclient/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions vendor/github.com/circonus-labs/go-apiclient/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/circonus-labs/go-apiclient/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/github.com/hashicorp/go-retryablehttp/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e3886f

Please sign in to comment.