From 0f954f24b5fff17172b61bc777f1c06f88c37e08 Mon Sep 17 00:00:00 2001 From: Vandy Liu Date: Wed, 3 Apr 2024 01:00:27 -0700 Subject: [PATCH] remove golines --- .github/workflows/test.yml | 21 ++++++++++----- Makefile | 12 ++++++--- internal/clients/iam/api.gen.go | 18 ++++++------- internal/clients/platform/api.gen.go | 38 ++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a510adb7..a0c3a0f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ permissions: jobs: # Ensure project builds before running testing matrix build: - name: Build + name: Build and unit test runs-on: ubuntu-latest timeout-minutes: 5 steps: @@ -27,12 +27,21 @@ jobs: with: go-version-file: 'go.mod' cache: true - - run: go mod download + - run: make fmt - run: go build -v . - - name: Run linters - uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 + - run: make test + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: - version: latest + go-version-file: 'go.mod' + cache: true + - run: make validate-fmt + generate: runs-on: ubuntu-latest @@ -80,7 +89,7 @@ jobs: with: terraform_version: ${{ matrix.terraform }} terraform_wrapper: false - - run: go mod download + - run: make fmt - env: TF_ACC: "1" run: go test -v -cover ./internal/provider/ diff --git a/Makefile b/Makefile index eedd7292..f47507a2 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,6 @@ $(ENVTEST_ASSETS_DIR): mkdir -p $(ENVTEST_ASSETS_DIR) MOCKERY ?= $(ENVTEST_ASSETS_DIR)/mockery OAPI_CODEGEN ?= $(ENVTEST_ASSETS_DIR)/oapi-codegen -LINTER ?= $(ENVTEST_ASSETS_DIR)/golangci-lint # Run acceptance tests .PHONY: testacc @@ -25,16 +24,23 @@ test: .PHONY: fmt fmt: - golines -w ./ gofmt -w ./ goimports -w ./ [ -z "$$CIRCLECI" ] || git diff --exit-code --color=always # In CI: exit if anything changed +.PHONY: validate-fmt +validate-fmt: + @output=$$(gofmt -l ./); \ + if [ -n "$$output" ]; then \ + echo "$$output"; \ + echo "Please run 'make fmt' to format the code"; \ + exit 1; \ + fi + .PHONY: dep dep: go mod download go install golang.org/x/tools/cmd/goimports - go install github.com/segmentio/golines@latest go mod tidy .PHONY: build diff --git a/internal/clients/iam/api.gen.go b/internal/clients/iam/api.gen.go index 3efeb4df..15c5e306 100644 --- a/internal/clients/iam/api.gen.go +++ b/internal/clients/iam/api.gen.go @@ -75,11 +75,6 @@ const ( CreateUserInviteRequestRoleORGANIZATIONOWNER CreateUserInviteRequestRole = "ORGANIZATION_OWNER" ) -// Defines values for DeploymentRoleRole. -const ( - DEPLOYMENTADMIN DeploymentRoleRole = "DEPLOYMENT_ADMIN" -) - // Defines values for SubjectRolesOrganizationRole. const ( SubjectRolesOrganizationRoleORGANIZATIONBILLINGADMIN SubjectRolesOrganizationRole = "ORGANIZATION_BILLING_ADMIN" @@ -353,13 +348,10 @@ type DeploymentRole struct { // DeploymentId The Deployment ID. DeploymentId string `json:"deploymentId"` - // Role The role of the subject in the Deployment. - Role DeploymentRoleRole `json:"role"` + // Role The name of the role for the subject in the Deployment. + Role string `json:"role"` } -// DeploymentRoleRole The role of the subject in the Deployment. -type DeploymentRoleRole string - // Error defines model for Error. type Error struct { Message string `json:"message"` @@ -514,6 +506,9 @@ type UpdateTeamRequest struct { // UpdateTeamRolesRequest defines model for UpdateTeamRolesRequest. type UpdateTeamRolesRequest struct { + // DeploymentRoles The user's updated Deployment roles. The Deployments you specify must belong to the Team's Organization. + DeploymentRoles *[]DeploymentRole `json:"deploymentRoles,omitempty"` + // OrganizationRole The Team's Organization roles. OrganizationRole UpdateTeamRolesRequestOrganizationRole `json:"organizationRole"` @@ -526,6 +521,9 @@ type UpdateTeamRolesRequestOrganizationRole string // UpdateUserRolesRequest defines model for UpdateUserRolesRequest. type UpdateUserRolesRequest struct { + // DeploymentRoles The user's updated Deployment roles. Requires also specifying an `OrganizationRole`. + DeploymentRoles *[]DeploymentRole `json:"deploymentRoles,omitempty"` + // OrganizationRole The user's updated Organization role. OrganizationRole *UpdateUserRolesRequestOrganizationRole `json:"organizationRole,omitempty"` diff --git a/internal/clients/platform/api.gen.go b/internal/clients/platform/api.gen.go index 059b23d5..ac969e44 100644 --- a/internal/clients/platform/api.gen.go +++ b/internal/clients/platform/api.gen.go @@ -2074,6 +2074,9 @@ type ListDeploymentsParams struct { // DeploymentIds A list of IDs for Deployments to show. The API returns details only for the specified Deployments. DeploymentIds *[]string `form:"deploymentIds,omitempty" json:"deploymentIds,omitempty"` + // Names A list of names for Deployments to filter by. The API returns details only for the specified Deployments. + Names *[]string `form:"names,omitempty" json:"names,omitempty"` + // WorkspaceIds A list of IDs for Workspaces to filter on. The API returns details for all Deployments belonging only to the specified Workspaces. WorkspaceIds *[]string `form:"workspaceIds,omitempty" json:"workspaceIds,omitempty"` @@ -2095,6 +2098,9 @@ type ListWorkspacesParams struct { // WorkspaceIds A list of IDs for specific Workspaces to list. The API will list information only for Workspaces which have been specified in this list. WorkspaceIds *[]string `form:"workspaceIds,omitempty" json:"workspaceIds,omitempty"` + // Names A list of names for specific Workspaces to filter by. The API will list information only for Workspaces which have been specified in this list. + Names *[]string `form:"names,omitempty" json:"names,omitempty"` + // Offset The number of results to skip before returning values. Offset *int `form:"offset,omitempty" json:"offset,omitempty"` @@ -3694,6 +3700,22 @@ func NewListDeploymentsRequest(server string, organizationId string, params *Lis } + if params.Names != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "names", runtime.ParamLocationQuery, *params.Names); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + if params.WorkspaceIds != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "workspaceIds", runtime.ParamLocationQuery, *params.WorkspaceIds); err != nil { @@ -4092,6 +4114,22 @@ func NewListWorkspacesRequest(server string, organizationId string, params *List } + if params.Names != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "names", runtime.ParamLocationQuery, *params.Names); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + if params.Offset != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil {