diff --git a/Justfile b/Justfile index 57d9fbdf..1ac6e9c1 100644 --- a/Justfile +++ b/Justfile @@ -30,6 +30,7 @@ generate-config-api-client: retrieve-config-api-openapi-spec setup-dev: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1 + go install github.com/segmentio/golines@latest test-client +ARGS='': cd {{ CONFIG_API_CLIENT_DIR }} && go test -v ./... -race -covermode=atomic -coverprofile=.coverage {{ ARGS }} @@ -38,7 +39,8 @@ coverage-client: cd {{ CONFIG_API_CLIENT_DIR }} && go tool cover -html=.coverage -o=.coverage.html fmt-client: - gofmt -w pkg/config-api-client + gofmt -w {{ CONFIG_API_CLIENT_DIR }} + golines -w {{ CONFIG_API_CLIENT_DIR }} tidy-client: cd {{ CONFIG_API_CLIENT_DIR }} && go mod tidy @@ -53,6 +55,11 @@ lint-client: exit 1 fi + if [ -n "$(golines . --dry-run)" ]; then + echo "Error: (golines) formatting required" >&2 + exit 1 + fi + golangci-lint run lint-provider: @@ -65,10 +72,16 @@ lint-provider: exit 1 fi + if [ -n "$(golines . --dry-run)" ]; then + echo "Error: (golines) formatting required" >&2 + exit 1 + fi + golangci-lint run fmt-provider: - gofmt -w pkg/config-api-provider + gofmt -w {{ CONFIG_API_PROVIDER_DIR }} + golines -w {{ CONFIG_API_PROVIDER_DIR }} tidy-provider: cd {{ CONFIG_API_PROVIDER_DIR }} && go mod tidy diff --git a/pkg/config-api-client/api_configuration.go b/pkg/config-api-client/api_configuration.go index f4240eee..615ac8e5 100644 --- a/pkg/config-api-client/api_configuration.go +++ b/pkg/config-api-client/api_configuration.go @@ -53,7 +53,7 @@ func (r ApiAgentsGetRequest) Execute() (*AgentsResponse, *http.Response, error) /* AgentsGet Agents Get -Get a list of agents +# Get a list of agents @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiAgentsGetRequest @@ -68,7 +68,9 @@ func (a *ConfigurationAPIService) AgentsGet(ctx context.Context) ApiAgentsGetReq // Execute executes the request // // @return AgentsResponse -func (a *ConfigurationAPIService) AgentsGetExecute(r ApiAgentsGetRequest) (*AgentsResponse, *http.Response, error) { +func (a *ConfigurationAPIService) AgentsGetExecute( + r ApiAgentsGetRequest, +) (*AgentsResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -76,7 +78,10 @@ func (a *ConfigurationAPIService) AgentsGetExecute(r ApiAgentsGetRequest) (*Agen localVarReturnValue *AgentsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.AgentsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.AgentsGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -116,7 +121,16 @@ func (a *ConfigurationAPIService) AgentsGetExecute(r ApiAgentsGetRequest) (*Agen if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -162,7 +176,11 @@ func (a *ConfigurationAPIService) AgentsGetExecute(r ApiAgentsGetRequest) (*Agen return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -193,7 +211,10 @@ Delete an existing group. @param groupUid @return ApiGroupsDeleteRequest */ -func (a *ConfigurationAPIService) GroupsDelete(ctx context.Context, groupUid string) ApiGroupsDeleteRequest { +func (a *ConfigurationAPIService) GroupsDelete( + ctx context.Context, + groupUid string, +) ApiGroupsDeleteRequest { return ApiGroupsDeleteRequest{ ApiService: a, ctx: ctx, @@ -204,7 +225,9 @@ func (a *ConfigurationAPIService) GroupsDelete(ctx context.Context, groupUid str // Execute executes the request // // @return interface{} -func (a *ConfigurationAPIService) GroupsDeleteExecute(r ApiGroupsDeleteRequest) (interface{}, *http.Response, error) { +func (a *ConfigurationAPIService) GroupsDeleteExecute( + r ApiGroupsDeleteRequest, +) (interface{}, *http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -212,13 +235,21 @@ func (a *ConfigurationAPIService) GroupsDeleteExecute(r ApiGroupsDeleteRequest) localVarReturnValue interface{} ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GroupsDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.GroupsDelete", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/networking-uxi/v1alpha1/groups/{group_uid}" - localVarPath = strings.Replace(localVarPath, "{"+"group_uid"+"}", url.PathEscape(parameterValueToString(r.groupUid, "groupUid")), -1) + localVarPath = strings.Replace( + localVarPath, + "{"+"group_uid"+"}", + url.PathEscape(parameterValueToString(r.groupUid, "groupUid")), + -1, + ) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -241,7 +272,16 @@ func (a *ConfigurationAPIService) GroupsDeleteExecute(r ApiGroupsDeleteRequest) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -287,7 +327,11 @@ func (a *ConfigurationAPIService) GroupsDeleteExecute(r ApiGroupsDeleteRequest) return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -329,7 +373,7 @@ func (r ApiGroupsGetRequest) Execute() (*GroupsGetResponse, *http.Response, erro /* GroupsGet Groups Get -Lists groups matching provided criteria +# Lists groups matching provided criteria @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiGroupsGetRequest @@ -344,7 +388,9 @@ func (a *ConfigurationAPIService) GroupsGet(ctx context.Context) ApiGroupsGetReq // Execute executes the request // // @return GroupsGetResponse -func (a *ConfigurationAPIService) GroupsGetExecute(r ApiGroupsGetRequest) (*GroupsGetResponse, *http.Response, error) { +func (a *ConfigurationAPIService) GroupsGetExecute( + r ApiGroupsGetRequest, +) (*GroupsGetResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -352,7 +398,10 @@ func (a *ConfigurationAPIService) GroupsGetExecute(r ApiGroupsGetRequest) (*Grou localVarReturnValue *GroupsGetResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GroupsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.GroupsGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -392,7 +441,16 @@ func (a *ConfigurationAPIService) GroupsGetExecute(r ApiGroupsGetRequest) (*Grou if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -438,7 +496,11 @@ func (a *ConfigurationAPIService) GroupsGetExecute(r ApiGroupsGetRequest) (*Grou return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -457,7 +519,9 @@ type ApiGroupsPatchRequest struct { groupsPatchRequest *GroupsPatchRequest } -func (r ApiGroupsPatchRequest) GroupsPatchRequest(groupsPatchRequest GroupsPatchRequest) ApiGroupsPatchRequest { +func (r ApiGroupsPatchRequest) GroupsPatchRequest( + groupsPatchRequest GroupsPatchRequest, +) ApiGroupsPatchRequest { r.groupsPatchRequest = &groupsPatchRequest return r } @@ -475,7 +539,10 @@ Update an existing group. @param groupUid @return ApiGroupsPatchRequest */ -func (a *ConfigurationAPIService) GroupsPatch(ctx context.Context, groupUid string) ApiGroupsPatchRequest { +func (a *ConfigurationAPIService) GroupsPatch( + ctx context.Context, + groupUid string, +) ApiGroupsPatchRequest { return ApiGroupsPatchRequest{ ApiService: a, ctx: ctx, @@ -486,7 +553,9 @@ func (a *ConfigurationAPIService) GroupsPatch(ctx context.Context, groupUid stri // Execute executes the request // // @return GroupsPatchResponse -func (a *ConfigurationAPIService) GroupsPatchExecute(r ApiGroupsPatchRequest) (*GroupsPatchResponse, *http.Response, error) { +func (a *ConfigurationAPIService) GroupsPatchExecute( + r ApiGroupsPatchRequest, +) (*GroupsPatchResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} @@ -494,13 +563,21 @@ func (a *ConfigurationAPIService) GroupsPatchExecute(r ApiGroupsPatchRequest) (* localVarReturnValue *GroupsPatchResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GroupsPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.GroupsPatch", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/networking-uxi/v1alpha1/groups/{group_uid}" - localVarPath = strings.Replace(localVarPath, "{"+"group_uid"+"}", url.PathEscape(parameterValueToString(r.groupUid, "groupUid")), -1) + localVarPath = strings.Replace( + localVarPath, + "{"+"group_uid"+"}", + url.PathEscape(parameterValueToString(r.groupUid, "groupUid")), + -1, + ) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -525,7 +602,16 @@ func (a *ConfigurationAPIService) GroupsPatchExecute(r ApiGroupsPatchRequest) (* } // body params localVarPostBody = r.groupsPatchRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -571,7 +657,11 @@ func (a *ConfigurationAPIService) GroupsPatchExecute(r ApiGroupsPatchRequest) (* return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -589,7 +679,9 @@ type ApiGroupsPostRequest struct { groupsPostRequest *GroupsPostRequest } -func (r ApiGroupsPostRequest) GroupsPostRequest(groupsPostRequest GroupsPostRequest) ApiGroupsPostRequest { +func (r ApiGroupsPostRequest) GroupsPostRequest( + groupsPostRequest GroupsPostRequest, +) ApiGroupsPostRequest { r.groupsPostRequest = &groupsPostRequest return r } @@ -601,7 +693,7 @@ func (r ApiGroupsPostRequest) Execute() (*GroupsPostResponse, *http.Response, er /* GroupsPost Groups Post -Create a new group with the group identified in `parentId` as its parent +# Create a new group with the group identified in `parentId` as its parent @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiGroupsPostRequest @@ -616,7 +708,9 @@ func (a *ConfigurationAPIService) GroupsPost(ctx context.Context) ApiGroupsPostR // Execute executes the request // // @return GroupsPostResponse -func (a *ConfigurationAPIService) GroupsPostExecute(r ApiGroupsPostRequest) (*GroupsPostResponse, *http.Response, error) { +func (a *ConfigurationAPIService) GroupsPostExecute( + r ApiGroupsPostRequest, +) (*GroupsPostResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -624,7 +718,10 @@ func (a *ConfigurationAPIService) GroupsPostExecute(r ApiGroupsPostRequest) (*Gr localVarReturnValue *GroupsPostResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.GroupsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.GroupsPost", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -635,7 +732,9 @@ func (a *ConfigurationAPIService) GroupsPostExecute(r ApiGroupsPostRequest) (*Gr localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.groupsPostRequest == nil { - return localVarReturnValue, nil, reportError("groupsPostRequest is required and must be specified") + return localVarReturnValue, nil, reportError( + "groupsPostRequest is required and must be specified", + ) } // to determine the Content-Type header @@ -657,7 +756,16 @@ func (a *ConfigurationAPIService) GroupsPostExecute(r ApiGroupsPostRequest) (*Gr } // body params localVarPostBody = r.groupsPostRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -703,7 +811,11 @@ func (a *ConfigurationAPIService) GroupsPostExecute(r ApiGroupsPostRequest) (*Gr return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -728,13 +840,16 @@ func (r ApiNetworkGroupAssignmentsDeleteRequest) Execute() (interface{}, *http.R /* NetworkGroupAssignmentsDelete Network Group Assignments Delete -Delete a network group assignment +# Delete a network group assignment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id @return ApiNetworkGroupAssignmentsDeleteRequest */ -func (a *ConfigurationAPIService) NetworkGroupAssignmentsDelete(ctx context.Context, id string) ApiNetworkGroupAssignmentsDeleteRequest { +func (a *ConfigurationAPIService) NetworkGroupAssignmentsDelete( + ctx context.Context, + id string, +) ApiNetworkGroupAssignmentsDeleteRequest { return ApiNetworkGroupAssignmentsDeleteRequest{ ApiService: a, ctx: ctx, @@ -745,7 +860,9 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsDelete(ctx context.Cont // Execute executes the request // // @return interface{} -func (a *ConfigurationAPIService) NetworkGroupAssignmentsDeleteExecute(r ApiNetworkGroupAssignmentsDeleteRequest) (interface{}, *http.Response, error) { +func (a *ConfigurationAPIService) NetworkGroupAssignmentsDeleteExecute( + r ApiNetworkGroupAssignmentsDeleteRequest, +) (interface{}, *http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -753,13 +870,21 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsDeleteExecute(r ApiNetw localVarReturnValue interface{} ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.NetworkGroupAssignmentsDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.NetworkGroupAssignmentsDelete", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/networking-uxi/v1alpha1/network-group-assignments/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace( + localVarPath, + "{"+"id"+"}", + url.PathEscape(parameterValueToString(r.id, "id")), + -1, + ) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -782,7 +907,16 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsDeleteExecute(r ApiNetw if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -828,7 +962,11 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsDeleteExecute(r ApiNetw return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -853,12 +991,16 @@ func (r ApiNetworkGroupAssignmentsGetRequest) Id(id string) ApiNetworkGroupAssig return r } -func (r ApiNetworkGroupAssignmentsGetRequest) Next(next string) ApiNetworkGroupAssignmentsGetRequest { +func (r ApiNetworkGroupAssignmentsGetRequest) Next( + next string, +) ApiNetworkGroupAssignmentsGetRequest { r.next = &next return r } -func (r ApiNetworkGroupAssignmentsGetRequest) Limit(limit int32) ApiNetworkGroupAssignmentsGetRequest { +func (r ApiNetworkGroupAssignmentsGetRequest) Limit( + limit int32, +) ApiNetworkGroupAssignmentsGetRequest { r.limit = &limit return r } @@ -870,12 +1012,14 @@ func (r ApiNetworkGroupAssignmentsGetRequest) Execute() (*NetworkGroupAssignment /* NetworkGroupAssignmentsGet Network Group Assignments Get -Get a list of network group assignments +# Get a list of network group assignments @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiNetworkGroupAssignmentsGetRequest */ -func (a *ConfigurationAPIService) NetworkGroupAssignmentsGet(ctx context.Context) ApiNetworkGroupAssignmentsGetRequest { +func (a *ConfigurationAPIService) NetworkGroupAssignmentsGet( + ctx context.Context, +) ApiNetworkGroupAssignmentsGetRequest { return ApiNetworkGroupAssignmentsGetRequest{ ApiService: a, ctx: ctx, @@ -885,7 +1029,9 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsGet(ctx context.Context // Execute executes the request // // @return NetworkGroupAssignmentsResponse -func (a *ConfigurationAPIService) NetworkGroupAssignmentsGetExecute(r ApiNetworkGroupAssignmentsGetRequest) (*NetworkGroupAssignmentsResponse, *http.Response, error) { +func (a *ConfigurationAPIService) NetworkGroupAssignmentsGetExecute( + r ApiNetworkGroupAssignmentsGetRequest, +) (*NetworkGroupAssignmentsResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -893,7 +1039,10 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsGetExecute(r ApiNetwork localVarReturnValue *NetworkGroupAssignmentsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.NetworkGroupAssignmentsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.NetworkGroupAssignmentsGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -933,7 +1082,16 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsGetExecute(r ApiNetwork if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -979,7 +1137,11 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsGetExecute(r ApiNetwork return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -997,7 +1159,9 @@ type ApiNetworkGroupAssignmentsPostRequest struct { networkGroupAssignmentsPostRequest *NetworkGroupAssignmentsPostRequest } -func (r ApiNetworkGroupAssignmentsPostRequest) NetworkGroupAssignmentsPostRequest(networkGroupAssignmentsPostRequest NetworkGroupAssignmentsPostRequest) ApiNetworkGroupAssignmentsPostRequest { +func (r ApiNetworkGroupAssignmentsPostRequest) NetworkGroupAssignmentsPostRequest( + networkGroupAssignmentsPostRequest NetworkGroupAssignmentsPostRequest, +) ApiNetworkGroupAssignmentsPostRequest { r.networkGroupAssignmentsPostRequest = &networkGroupAssignmentsPostRequest return r } @@ -1009,12 +1173,14 @@ func (r ApiNetworkGroupAssignmentsPostRequest) Execute() (*NetworkGroupAssignmen /* NetworkGroupAssignmentsPost Network Group Assignments Post -Create a network group assignment +# Create a network group assignment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiNetworkGroupAssignmentsPostRequest */ -func (a *ConfigurationAPIService) NetworkGroupAssignmentsPost(ctx context.Context) ApiNetworkGroupAssignmentsPostRequest { +func (a *ConfigurationAPIService) NetworkGroupAssignmentsPost( + ctx context.Context, +) ApiNetworkGroupAssignmentsPostRequest { return ApiNetworkGroupAssignmentsPostRequest{ ApiService: a, ctx: ctx, @@ -1024,7 +1190,9 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsPost(ctx context.Contex // Execute executes the request // // @return NetworkGroupAssignmentsPostResponse -func (a *ConfigurationAPIService) NetworkGroupAssignmentsPostExecute(r ApiNetworkGroupAssignmentsPostRequest) (*NetworkGroupAssignmentsPostResponse, *http.Response, error) { +func (a *ConfigurationAPIService) NetworkGroupAssignmentsPostExecute( + r ApiNetworkGroupAssignmentsPostRequest, +) (*NetworkGroupAssignmentsPostResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -1032,7 +1200,10 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsPostExecute(r ApiNetwor localVarReturnValue *NetworkGroupAssignmentsPostResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.NetworkGroupAssignmentsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.NetworkGroupAssignmentsPost", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1043,7 +1214,9 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsPostExecute(r ApiNetwor localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.networkGroupAssignmentsPostRequest == nil { - return localVarReturnValue, nil, reportError("networkGroupAssignmentsPostRequest is required and must be specified") + return localVarReturnValue, nil, reportError( + "networkGroupAssignmentsPostRequest is required and must be specified", + ) } // to determine the Content-Type header @@ -1065,7 +1238,16 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsPostExecute(r ApiNetwor } // body params localVarPostBody = r.networkGroupAssignmentsPostRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1111,7 +1293,11 @@ func (a *ConfigurationAPIService) NetworkGroupAssignmentsPostExecute(r ApiNetwor return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1136,13 +1322,16 @@ func (r ApiSensorGroupAssignmentsDeleteRequest) Execute() (interface{}, *http.Re /* SensorGroupAssignmentsDelete Sensor Group Assignments Delete -Delete a sensor group assignment +# Delete a sensor group assignment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id @return ApiSensorGroupAssignmentsDeleteRequest */ -func (a *ConfigurationAPIService) SensorGroupAssignmentsDelete(ctx context.Context, id string) ApiSensorGroupAssignmentsDeleteRequest { +func (a *ConfigurationAPIService) SensorGroupAssignmentsDelete( + ctx context.Context, + id string, +) ApiSensorGroupAssignmentsDeleteRequest { return ApiSensorGroupAssignmentsDeleteRequest{ ApiService: a, ctx: ctx, @@ -1153,7 +1342,9 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsDelete(ctx context.Conte // Execute executes the request // // @return interface{} -func (a *ConfigurationAPIService) SensorGroupAssignmentsDeleteExecute(r ApiSensorGroupAssignmentsDeleteRequest) (interface{}, *http.Response, error) { +func (a *ConfigurationAPIService) SensorGroupAssignmentsDeleteExecute( + r ApiSensorGroupAssignmentsDeleteRequest, +) (interface{}, *http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -1161,13 +1352,21 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsDeleteExecute(r ApiSenso localVarReturnValue interface{} ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.SensorGroupAssignmentsDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.SensorGroupAssignmentsDelete", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/networking-uxi/v1alpha1/sensor-group-assignments/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace( + localVarPath, + "{"+"id"+"}", + url.PathEscape(parameterValueToString(r.id, "id")), + -1, + ) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1190,7 +1389,16 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsDeleteExecute(r ApiSenso if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1236,7 +1444,11 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsDeleteExecute(r ApiSenso return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1266,7 +1478,9 @@ func (r ApiSensorGroupAssignmentsGetRequest) Next(next string) ApiSensorGroupAss return r } -func (r ApiSensorGroupAssignmentsGetRequest) Limit(limit int32) ApiSensorGroupAssignmentsGetRequest { +func (r ApiSensorGroupAssignmentsGetRequest) Limit( + limit int32, +) ApiSensorGroupAssignmentsGetRequest { r.limit = &limit return r } @@ -1278,12 +1492,14 @@ func (r ApiSensorGroupAssignmentsGetRequest) Execute() (*SensorGroupAssignmentsR /* SensorGroupAssignmentsGet Sensor Group Assignments Get -Get a list of sensor group assignments +# Get a list of sensor group assignments @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiSensorGroupAssignmentsGetRequest */ -func (a *ConfigurationAPIService) SensorGroupAssignmentsGet(ctx context.Context) ApiSensorGroupAssignmentsGetRequest { +func (a *ConfigurationAPIService) SensorGroupAssignmentsGet( + ctx context.Context, +) ApiSensorGroupAssignmentsGetRequest { return ApiSensorGroupAssignmentsGetRequest{ ApiService: a, ctx: ctx, @@ -1293,7 +1509,9 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsGet(ctx context.Context) // Execute executes the request // // @return SensorGroupAssignmentsResponse -func (a *ConfigurationAPIService) SensorGroupAssignmentsGetExecute(r ApiSensorGroupAssignmentsGetRequest) (*SensorGroupAssignmentsResponse, *http.Response, error) { +func (a *ConfigurationAPIService) SensorGroupAssignmentsGetExecute( + r ApiSensorGroupAssignmentsGetRequest, +) (*SensorGroupAssignmentsResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -1301,7 +1519,10 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsGetExecute(r ApiSensorGr localVarReturnValue *SensorGroupAssignmentsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.SensorGroupAssignmentsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.SensorGroupAssignmentsGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1341,7 +1562,16 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsGetExecute(r ApiSensorGr if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1387,7 +1617,11 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsGetExecute(r ApiSensorGr return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1405,7 +1639,9 @@ type ApiSensorGroupAssignmentsPostRequest struct { sensorGroupAssignmentsPostRequest *SensorGroupAssignmentsPostRequest } -func (r ApiSensorGroupAssignmentsPostRequest) SensorGroupAssignmentsPostRequest(sensorGroupAssignmentsPostRequest SensorGroupAssignmentsPostRequest) ApiSensorGroupAssignmentsPostRequest { +func (r ApiSensorGroupAssignmentsPostRequest) SensorGroupAssignmentsPostRequest( + sensorGroupAssignmentsPostRequest SensorGroupAssignmentsPostRequest, +) ApiSensorGroupAssignmentsPostRequest { r.sensorGroupAssignmentsPostRequest = &sensorGroupAssignmentsPostRequest return r } @@ -1417,12 +1653,14 @@ func (r ApiSensorGroupAssignmentsPostRequest) Execute() (*SensorGroupAssignmentR /* SensorGroupAssignmentsPost Sensor Group Assignments Post -Create sensor group assignment +# Create sensor group assignment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiSensorGroupAssignmentsPostRequest */ -func (a *ConfigurationAPIService) SensorGroupAssignmentsPost(ctx context.Context) ApiSensorGroupAssignmentsPostRequest { +func (a *ConfigurationAPIService) SensorGroupAssignmentsPost( + ctx context.Context, +) ApiSensorGroupAssignmentsPostRequest { return ApiSensorGroupAssignmentsPostRequest{ ApiService: a, ctx: ctx, @@ -1432,7 +1670,9 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsPost(ctx context.Context // Execute executes the request // // @return SensorGroupAssignmentResponse -func (a *ConfigurationAPIService) SensorGroupAssignmentsPostExecute(r ApiSensorGroupAssignmentsPostRequest) (*SensorGroupAssignmentResponse, *http.Response, error) { +func (a *ConfigurationAPIService) SensorGroupAssignmentsPostExecute( + r ApiSensorGroupAssignmentsPostRequest, +) (*SensorGroupAssignmentResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -1440,7 +1680,10 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsPostExecute(r ApiSensorG localVarReturnValue *SensorGroupAssignmentResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.SensorGroupAssignmentsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.SensorGroupAssignmentsPost", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1451,7 +1694,9 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsPostExecute(r ApiSensorG localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.sensorGroupAssignmentsPostRequest == nil { - return localVarReturnValue, nil, reportError("sensorGroupAssignmentsPostRequest is required and must be specified") + return localVarReturnValue, nil, reportError( + "sensorGroupAssignmentsPostRequest is required and must be specified", + ) } // to determine the Content-Type header @@ -1473,7 +1718,16 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsPostExecute(r ApiSensorG } // body params localVarPostBody = r.sensorGroupAssignmentsPostRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1519,7 +1773,11 @@ func (a *ConfigurationAPIService) SensorGroupAssignmentsPostExecute(r ApiSensorG return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1561,7 +1819,7 @@ func (r ApiSensorsGetRequest) Execute() (*SensorsResponse, *http.Response, error /* SensorsGet Sensors Get -Get a list of sensors +# Get a list of sensors @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiSensorsGetRequest @@ -1576,7 +1834,9 @@ func (a *ConfigurationAPIService) SensorsGet(ctx context.Context) ApiSensorsGetR // Execute executes the request // // @return SensorsResponse -func (a *ConfigurationAPIService) SensorsGetExecute(r ApiSensorsGetRequest) (*SensorsResponse, *http.Response, error) { +func (a *ConfigurationAPIService) SensorsGetExecute( + r ApiSensorsGetRequest, +) (*SensorsResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -1584,7 +1844,10 @@ func (a *ConfigurationAPIService) SensorsGetExecute(r ApiSensorsGetRequest) (*Se localVarReturnValue *SensorsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.SensorsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.SensorsGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1624,7 +1887,16 @@ func (a *ConfigurationAPIService) SensorsGetExecute(r ApiSensorsGetRequest) (*Se if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1670,7 +1942,11 @@ func (a *ConfigurationAPIService) SensorsGetExecute(r ApiSensorsGetRequest) (*Se return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1689,7 +1965,9 @@ type ApiSensorsPatchRequest struct { sensorsPatchRequest *SensorsPatchRequest } -func (r ApiSensorsPatchRequest) SensorsPatchRequest(sensorsPatchRequest SensorsPatchRequest) ApiSensorsPatchRequest { +func (r ApiSensorsPatchRequest) SensorsPatchRequest( + sensorsPatchRequest SensorsPatchRequest, +) ApiSensorsPatchRequest { r.sensorsPatchRequest = &sensorsPatchRequest return r } @@ -1707,7 +1985,10 @@ Update an existing sensor. @param sensorUid @return ApiSensorsPatchRequest */ -func (a *ConfigurationAPIService) SensorsPatch(ctx context.Context, sensorUid string) ApiSensorsPatchRequest { +func (a *ConfigurationAPIService) SensorsPatch( + ctx context.Context, + sensorUid string, +) ApiSensorsPatchRequest { return ApiSensorsPatchRequest{ ApiService: a, ctx: ctx, @@ -1718,7 +1999,9 @@ func (a *ConfigurationAPIService) SensorsPatch(ctx context.Context, sensorUid st // Execute executes the request // // @return SensorsPatchResponse -func (a *ConfigurationAPIService) SensorsPatchExecute(r ApiSensorsPatchRequest) (*SensorsPatchResponse, *http.Response, error) { +func (a *ConfigurationAPIService) SensorsPatchExecute( + r ApiSensorsPatchRequest, +) (*SensorsPatchResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} @@ -1726,19 +2009,29 @@ func (a *ConfigurationAPIService) SensorsPatchExecute(r ApiSensorsPatchRequest) localVarReturnValue *SensorsPatchResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.SensorsPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.SensorsPatch", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/networking-uxi/v1alpha1/sensors/{sensor_uid}" - localVarPath = strings.Replace(localVarPath, "{"+"sensor_uid"+"}", url.PathEscape(parameterValueToString(r.sensorUid, "sensorUid")), -1) + localVarPath = strings.Replace( + localVarPath, + "{"+"sensor_uid"+"}", + url.PathEscape(parameterValueToString(r.sensorUid, "sensorUid")), + -1, + ) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.sensorsPatchRequest == nil { - return localVarReturnValue, nil, reportError("sensorsPatchRequest is required and must be specified") + return localVarReturnValue, nil, reportError( + "sensorsPatchRequest is required and must be specified", + ) } // to determine the Content-Type header @@ -1760,7 +2053,16 @@ func (a *ConfigurationAPIService) SensorsPatchExecute(r ApiSensorsPatchRequest) } // body params localVarPostBody = r.sensorsPatchRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1806,7 +2108,11 @@ func (a *ConfigurationAPIService) SensorsPatchExecute(r ApiSensorsPatchRequest) return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1831,13 +2137,16 @@ func (r ApiServiceTestGroupAssignmentsDeleteRequest) Execute() (interface{}, *ht /* ServiceTestGroupAssignmentsDelete Service Test Group Assignments Delete -Delete a service test group assignment +# Delete a service test group assignment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param id @return ApiServiceTestGroupAssignmentsDeleteRequest */ -func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDelete(ctx context.Context, id string) ApiServiceTestGroupAssignmentsDeleteRequest { +func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDelete( + ctx context.Context, + id string, +) ApiServiceTestGroupAssignmentsDeleteRequest { return ApiServiceTestGroupAssignmentsDeleteRequest{ ApiService: a, ctx: ctx, @@ -1848,7 +2157,9 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDelete(ctx context. // Execute executes the request // // @return interface{} -func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDeleteExecute(r ApiServiceTestGroupAssignmentsDeleteRequest) (interface{}, *http.Response, error) { +func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDeleteExecute( + r ApiServiceTestGroupAssignmentsDeleteRequest, +) (interface{}, *http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -1856,13 +2167,21 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDeleteExecute(r Api localVarReturnValue interface{} ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.ServiceTestGroupAssignmentsDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.ServiceTestGroupAssignmentsDelete", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/networking-uxi/v1alpha1/service-test-group-assignments/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + localVarPath = strings.Replace( + localVarPath, + "{"+"id"+"}", + url.PathEscape(parameterValueToString(r.id, "id")), + -1, + ) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1885,7 +2204,16 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDeleteExecute(r Api if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -1931,7 +2259,11 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsDeleteExecute(r Api return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -1949,7 +2281,9 @@ type ApiServiceTestGroupAssignmentsPostRequest struct { serviceTestGroupAssignmentsPostRequest *ServiceTestGroupAssignmentsPostRequest } -func (r ApiServiceTestGroupAssignmentsPostRequest) ServiceTestGroupAssignmentsPostRequest(serviceTestGroupAssignmentsPostRequest ServiceTestGroupAssignmentsPostRequest) ApiServiceTestGroupAssignmentsPostRequest { +func (r ApiServiceTestGroupAssignmentsPostRequest) ServiceTestGroupAssignmentsPostRequest( + serviceTestGroupAssignmentsPostRequest ServiceTestGroupAssignmentsPostRequest, +) ApiServiceTestGroupAssignmentsPostRequest { r.serviceTestGroupAssignmentsPostRequest = &serviceTestGroupAssignmentsPostRequest return r } @@ -1961,12 +2295,14 @@ func (r ApiServiceTestGroupAssignmentsPostRequest) Execute() (*ServiceTestGroupA /* ServiceTestGroupAssignmentsPost Service Test Group Assignments Post -Create a service-test group assignment +# Create a service-test group assignment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiServiceTestGroupAssignmentsPostRequest */ -func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPost(ctx context.Context) ApiServiceTestGroupAssignmentsPostRequest { +func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPost( + ctx context.Context, +) ApiServiceTestGroupAssignmentsPostRequest { return ApiServiceTestGroupAssignmentsPostRequest{ ApiService: a, ctx: ctx, @@ -1976,7 +2312,9 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPost(ctx context.Co // Execute executes the request // // @return ServiceTestGroupAssignmentsPostResponse -func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPostExecute(r ApiServiceTestGroupAssignmentsPostRequest) (*ServiceTestGroupAssignmentsPostResponse, *http.Response, error) { +func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPostExecute( + r ApiServiceTestGroupAssignmentsPostRequest, +) (*ServiceTestGroupAssignmentsPostResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -1984,7 +2322,10 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPostExecute(r ApiSe localVarReturnValue *ServiceTestGroupAssignmentsPostResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.ServiceTestGroupAssignmentsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.ServiceTestGroupAssignmentsPost", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1995,7 +2336,9 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPostExecute(r ApiSe localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.serviceTestGroupAssignmentsPostRequest == nil { - return localVarReturnValue, nil, reportError("serviceTestGroupAssignmentsPostRequest is required and must be specified") + return localVarReturnValue, nil, reportError( + "serviceTestGroupAssignmentsPostRequest is required and must be specified", + ) } // to determine the Content-Type header @@ -2017,7 +2360,16 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPostExecute(r ApiSe } // body params localVarPostBody = r.serviceTestGroupAssignmentsPostRequest - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -2063,7 +2415,11 @@ func (a *ConfigurationAPIService) ServiceTestGroupAssignmentsPostExecute(r ApiSe return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -2105,7 +2461,7 @@ func (r ApiServiceTestsGetRequest) Execute() (*ServiceTestsListResponse, *http.R /* ServiceTestsGet Service Tests Get -Lists service-tests matching provided criteria +# Lists service-tests matching provided criteria @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiServiceTestsGetRequest @@ -2120,7 +2476,9 @@ func (a *ConfigurationAPIService) ServiceTestsGet(ctx context.Context) ApiServic // Execute executes the request // // @return ServiceTestsListResponse -func (a *ConfigurationAPIService) ServiceTestsGetExecute(r ApiServiceTestsGetRequest) (*ServiceTestsListResponse, *http.Response, error) { +func (a *ConfigurationAPIService) ServiceTestsGetExecute( + r ApiServiceTestsGetRequest, +) (*ServiceTestsListResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -2128,7 +2486,10 @@ func (a *ConfigurationAPIService) ServiceTestsGetExecute(r ApiServiceTestsGetReq localVarReturnValue *ServiceTestsListResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.ServiceTestsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.ServiceTestsGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -2168,7 +2529,16 @@ func (a *ConfigurationAPIService) ServiceTestsGetExecute(r ApiServiceTestsGetReq if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -2214,7 +2584,11 @@ func (a *ConfigurationAPIService) ServiceTestsGetExecute(r ApiServiceTestsGetReq return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -2256,7 +2630,7 @@ func (r ApiWiredNetworksGetRequest) Execute() (*WiredNetworksResponse, *http.Res /* WiredNetworksGet Wired Networks Get -Get a list of wired networks +# Get a list of wired networks @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiWiredNetworksGetRequest @@ -2271,7 +2645,9 @@ func (a *ConfigurationAPIService) WiredNetworksGet(ctx context.Context) ApiWired // Execute executes the request // // @return WiredNetworksResponse -func (a *ConfigurationAPIService) WiredNetworksGetExecute(r ApiWiredNetworksGetRequest) (*WiredNetworksResponse, *http.Response, error) { +func (a *ConfigurationAPIService) WiredNetworksGetExecute( + r ApiWiredNetworksGetRequest, +) (*WiredNetworksResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -2279,7 +2655,10 @@ func (a *ConfigurationAPIService) WiredNetworksGetExecute(r ApiWiredNetworksGetR localVarReturnValue *WiredNetworksResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.WiredNetworksGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.WiredNetworksGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -2319,7 +2698,16 @@ func (a *ConfigurationAPIService) WiredNetworksGetExecute(r ApiWiredNetworksGetR if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -2365,7 +2753,11 @@ func (a *ConfigurationAPIService) WiredNetworksGetExecute(r ApiWiredNetworksGetR return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, @@ -2407,12 +2799,14 @@ func (r ApiWirelessNetworksGetRequest) Execute() (*WirelessNetworksResponse, *ht /* WirelessNetworksGet Wireless Networks Get -Get a list of wireless networks +# Get a list of wireless networks @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiWirelessNetworksGetRequest */ -func (a *ConfigurationAPIService) WirelessNetworksGet(ctx context.Context) ApiWirelessNetworksGetRequest { +func (a *ConfigurationAPIService) WirelessNetworksGet( + ctx context.Context, +) ApiWirelessNetworksGetRequest { return ApiWirelessNetworksGetRequest{ ApiService: a, ctx: ctx, @@ -2422,7 +2816,9 @@ func (a *ConfigurationAPIService) WirelessNetworksGet(ctx context.Context) ApiWi // Execute executes the request // // @return WirelessNetworksResponse -func (a *ConfigurationAPIService) WirelessNetworksGetExecute(r ApiWirelessNetworksGetRequest) (*WirelessNetworksResponse, *http.Response, error) { +func (a *ConfigurationAPIService) WirelessNetworksGetExecute( + r ApiWirelessNetworksGetRequest, +) (*WirelessNetworksResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -2430,7 +2826,10 @@ func (a *ConfigurationAPIService) WirelessNetworksGetExecute(r ApiWirelessNetwor localVarReturnValue *WirelessNetworksResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConfigurationAPIService.WirelessNetworksGet") + localBasePath, err := a.client.cfg.ServerURLWithContext( + r.ctx, + "ConfigurationAPIService.WirelessNetworksGet", + ) if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -2470,7 +2869,16 @@ func (a *ConfigurationAPIService) WirelessNetworksGetExecute(r ApiWirelessNetwor if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + req, err := a.client.prepareRequest( + r.ctx, + localVarPath, + localVarHTTPMethod, + localVarPostBody, + localVarHeaderParams, + localVarQueryParams, + localVarFormParams, + formFiles, + ) if err != nil { return localVarReturnValue, nil, err } @@ -2516,7 +2924,11 @@ func (a *ConfigurationAPIService) WirelessNetworksGetExecute(r ApiWirelessNetwor return localVarReturnValue, localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + err = a.client.decode( + &localVarReturnValue, + localVarBody, + localVarHTTPResponse.Header.Get("Content-Type"), + ) if err != nil { newErr := &GenericOpenAPIError{ body: localVarBody, diff --git a/pkg/config-api-client/client.go b/pkg/config-api-client/client.go index 2d78f019..bc254965 100644 --- a/pkg/config-api-client/client.go +++ b/pkg/config-api-client/client.go @@ -120,7 +120,12 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + return fmt.Errorf( + "expected %s to be of type %s but received %s", + name, + expected, + reflect.TypeOf(obj).String(), + ) } return nil } @@ -142,7 +147,13 @@ func parameterValueToString(obj interface{}, key string) string { // parameterAddToHeaderOrQuery adds the provided object to the request header or url query // supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { +func parameterAddToHeaderOrQuery( + headerOrQueryParams interface{}, + keyPrefix string, + obj interface{}, + style string, + collectionType string, +) { var v = reflect.ValueOf(obj) var value = "" if v == reflect.ValueOf(nil) { @@ -304,7 +315,9 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && + len(formParams) > 0 || + (len(formFiles) > 0) { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -326,7 +339,10 @@ func (c *APIClient) prepareRequest( for _, formFile := range formFiles { if len(formFile.fileBytes) > 0 && formFile.fileName != "" { w.Boundary() - part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + part, err := w.CreateFormFile( + formFile.formFileName, + filepath.Base(formFile.fileName), + ) if err != nil { return nil, err } @@ -345,9 +361,12 @@ func (c *APIClient) prepareRequest( w.Close() } - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && + len(formParams) > 0 { if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + return nil, errors.New( + "Cannot specify postBody and x-www-form-urlencoded form at the same time.", + ) } body = &bytes.Buffer{} body.WriteString(formParams.Encode()) diff --git a/pkg/config-api-client/configuration.go b/pkg/config-api-client/configuration.go index 3e321313..877e71d5 100644 --- a/pkg/config-api-client/configuration.go +++ b/pkg/config-api-client/configuration.go @@ -130,7 +130,12 @@ func (sc ServerConfigurations) URL(index int, variables map[string]string) (stri } } if !found { - return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + return "", fmt.Errorf( + "the variable %s in the server URL has invalid value %v. Must be %v", + name, + value, + variable.EnumValues, + ) } url = strings.Replace(url, "{"+name+"}", value, -1) } else { @@ -177,7 +182,10 @@ func getServerVariables(ctx context.Context) (map[string]string, error) { if variables, ok := sv.(map[string]string); ok { return variables, nil } - return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + return nil, reportError( + "ctx value of ContextServerVariables has invalid type %T should be map[string]string", + sv, + ) } return nil, nil } @@ -186,7 +194,10 @@ func getServerOperationVariables(ctx context.Context, endpoint string) (map[stri osv := ctx.Value(ContextOperationServerVariables) if osv != nil { if operationVariables, ok := osv.(map[string]map[string]string); !ok { - return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + return nil, reportError( + "ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", + osv, + ) } else { variables, ok := operationVariables[endpoint] if ok { diff --git a/pkg/config-api-client/model_agent_item.go b/pkg/config-api-client/model_agent_item.go index c137809c..93b3b036 100644 --- a/pkg/config-api-client/model_agent_item.go +++ b/pkg/config-api-client/model_agent_item.go @@ -39,7 +39,17 @@ type _AgentItem AgentItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewAgentItem(id string, serial string, name string, modelNumber NullableString, wifiMacAddress NullableString, ethernetMacAddress NullableString, notes NullableString, pcapMode NullableString, type_ string) *AgentItem { +func NewAgentItem( + id string, + serial string, + name string, + modelNumber NullableString, + wifiMacAddress NullableString, + ethernetMacAddress NullableString, + notes NullableString, + pcapMode NullableString, + type_ string, +) *AgentItem { this := AgentItem{} this.Id = id this.Serial = serial diff --git a/pkg/config-api-client/model_error_response.go b/pkg/config-api-client/model_error_response.go index 59fa33bf..1b45cc96 100644 --- a/pkg/config-api-client/model_error_response.go +++ b/pkg/config-api-client/model_error_response.go @@ -35,7 +35,12 @@ type _ErrorResponse ErrorResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewErrorResponse(debugId string, errorCode string, httpStatusCode int32, message string) *ErrorResponse { +func NewErrorResponse( + debugId string, + errorCode string, + httpStatusCode int32, + message string, +) *ErrorResponse { this := ErrorResponse{} this.DebugId = debugId this.ErrorCode = errorCode diff --git a/pkg/config-api-client/model_groups_get_item.go b/pkg/config-api-client/model_groups_get_item.go index 875f3523..27864226 100644 --- a/pkg/config-api-client/model_groups_get_item.go +++ b/pkg/config-api-client/model_groups_get_item.go @@ -35,7 +35,13 @@ type _GroupsGetItem GroupsGetItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGroupsGetItem(id string, name string, parent NullableParent, path string, type_ string) *GroupsGetItem { +func NewGroupsGetItem( + id string, + name string, + parent NullableParent, + path string, + type_ string, +) *GroupsGetItem { this := GroupsGetItem{} this.Id = id this.Name = name diff --git a/pkg/config-api-client/model_groups_get_response.go b/pkg/config-api-client/model_groups_get_response.go index 61f69e0d..1865a526 100644 --- a/pkg/config-api-client/model_groups_get_response.go +++ b/pkg/config-api-client/model_groups_get_response.go @@ -33,7 +33,11 @@ type _GroupsGetResponse GroupsGetResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGroupsGetResponse(items []GroupsGetItem, count int32, next NullableString) *GroupsGetResponse { +func NewGroupsGetResponse( + items []GroupsGetItem, + count int32, + next NullableString, +) *GroupsGetResponse { this := GroupsGetResponse{} this.Items = items this.Count = count diff --git a/pkg/config-api-client/model_groups_patch_response.go b/pkg/config-api-client/model_groups_patch_response.go index f3561513..2acd4820 100644 --- a/pkg/config-api-client/model_groups_patch_response.go +++ b/pkg/config-api-client/model_groups_patch_response.go @@ -35,7 +35,13 @@ type _GroupsPatchResponse GroupsPatchResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGroupsPatchResponse(id string, name string, path string, parent Parent, type_ string) *GroupsPatchResponse { +func NewGroupsPatchResponse( + id string, + name string, + path string, + parent Parent, + type_ string, +) *GroupsPatchResponse { this := GroupsPatchResponse{} this.Id = id this.Name = name diff --git a/pkg/config-api-client/model_groups_post_response.go b/pkg/config-api-client/model_groups_post_response.go index aba0f8c1..40a861a6 100644 --- a/pkg/config-api-client/model_groups_post_response.go +++ b/pkg/config-api-client/model_groups_post_response.go @@ -35,7 +35,13 @@ type _GroupsPostResponse GroupsPostResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGroupsPostResponse(id string, name string, path string, parent Parent, type_ string) *GroupsPostResponse { +func NewGroupsPostResponse( + id string, + name string, + path string, + parent Parent, + type_ string, +) *GroupsPostResponse { this := GroupsPostResponse{} this.Id = id this.Name = name diff --git a/pkg/config-api-client/model_network_group_assignments_item.go b/pkg/config-api-client/model_network_group_assignments_item.go index d7cddcb2..8a67a80b 100644 --- a/pkg/config-api-client/model_network_group_assignments_item.go +++ b/pkg/config-api-client/model_network_group_assignments_item.go @@ -34,7 +34,12 @@ type _NetworkGroupAssignmentsItem NetworkGroupAssignmentsItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewNetworkGroupAssignmentsItem(id string, group Group, network Network, type_ string) *NetworkGroupAssignmentsItem { +func NewNetworkGroupAssignmentsItem( + id string, + group Group, + network Network, + type_ string, +) *NetworkGroupAssignmentsItem { this := NetworkGroupAssignmentsItem{} this.Id = id this.Group = group @@ -227,7 +232,9 @@ func (v *NullableNetworkGroupAssignmentsItem) Unset() { v.isSet = false } -func NewNullableNetworkGroupAssignmentsItem(val *NetworkGroupAssignmentsItem) *NullableNetworkGroupAssignmentsItem { +func NewNullableNetworkGroupAssignmentsItem( + val *NetworkGroupAssignmentsItem, +) *NullableNetworkGroupAssignmentsItem { return &NullableNetworkGroupAssignmentsItem{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_network_group_assignments_post_request.go b/pkg/config-api-client/model_network_group_assignments_post_request.go index c1812f4e..7b6882f9 100644 --- a/pkg/config-api-client/model_network_group_assignments_post_request.go +++ b/pkg/config-api-client/model_network_group_assignments_post_request.go @@ -32,7 +32,10 @@ type _NetworkGroupAssignmentsPostRequest NetworkGroupAssignmentsPostRequest // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewNetworkGroupAssignmentsPostRequest(groupId string, networkId string) *NetworkGroupAssignmentsPostRequest { +func NewNetworkGroupAssignmentsPostRequest( + groupId string, + networkId string, +) *NetworkGroupAssignmentsPostRequest { this := NetworkGroupAssignmentsPostRequest{} this.GroupId = groupId this.NetworkId = networkId @@ -171,7 +174,9 @@ func (v *NullableNetworkGroupAssignmentsPostRequest) Unset() { v.isSet = false } -func NewNullableNetworkGroupAssignmentsPostRequest(val *NetworkGroupAssignmentsPostRequest) *NullableNetworkGroupAssignmentsPostRequest { +func NewNullableNetworkGroupAssignmentsPostRequest( + val *NetworkGroupAssignmentsPostRequest, +) *NullableNetworkGroupAssignmentsPostRequest { return &NullableNetworkGroupAssignmentsPostRequest{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_network_group_assignments_post_response.go b/pkg/config-api-client/model_network_group_assignments_post_response.go index 83a835ab..d8e27e8c 100644 --- a/pkg/config-api-client/model_network_group_assignments_post_response.go +++ b/pkg/config-api-client/model_network_group_assignments_post_response.go @@ -34,7 +34,12 @@ type _NetworkGroupAssignmentsPostResponse NetworkGroupAssignmentsPostResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewNetworkGroupAssignmentsPostResponse(id string, group Group, network Network, type_ string) *NetworkGroupAssignmentsPostResponse { +func NewNetworkGroupAssignmentsPostResponse( + id string, + group Group, + network Network, + type_ string, +) *NetworkGroupAssignmentsPostResponse { this := NetworkGroupAssignmentsPostResponse{} this.Id = id this.Group = group @@ -213,7 +218,9 @@ func (v NullableNetworkGroupAssignmentsPostResponse) Get() *NetworkGroupAssignme return v.value } -func (v *NullableNetworkGroupAssignmentsPostResponse) Set(val *NetworkGroupAssignmentsPostResponse) { +func (v *NullableNetworkGroupAssignmentsPostResponse) Set( + val *NetworkGroupAssignmentsPostResponse, +) { v.value = val v.isSet = true } @@ -227,7 +234,9 @@ func (v *NullableNetworkGroupAssignmentsPostResponse) Unset() { v.isSet = false } -func NewNullableNetworkGroupAssignmentsPostResponse(val *NetworkGroupAssignmentsPostResponse) *NullableNetworkGroupAssignmentsPostResponse { +func NewNullableNetworkGroupAssignmentsPostResponse( + val *NetworkGroupAssignmentsPostResponse, +) *NullableNetworkGroupAssignmentsPostResponse { return &NullableNetworkGroupAssignmentsPostResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_network_group_assignments_response.go b/pkg/config-api-client/model_network_group_assignments_response.go index a5619042..63c5a6df 100644 --- a/pkg/config-api-client/model_network_group_assignments_response.go +++ b/pkg/config-api-client/model_network_group_assignments_response.go @@ -33,7 +33,11 @@ type _NetworkGroupAssignmentsResponse NetworkGroupAssignmentsResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewNetworkGroupAssignmentsResponse(items []NetworkGroupAssignmentsItem, count int32, next NullableString) *NetworkGroupAssignmentsResponse { +func NewNetworkGroupAssignmentsResponse( + items []NetworkGroupAssignmentsItem, + count int32, + next NullableString, +) *NetworkGroupAssignmentsResponse { this := NetworkGroupAssignmentsResponse{} this.Items = items this.Count = count @@ -201,7 +205,9 @@ func (v *NullableNetworkGroupAssignmentsResponse) Unset() { v.isSet = false } -func NewNullableNetworkGroupAssignmentsResponse(val *NetworkGroupAssignmentsResponse) *NullableNetworkGroupAssignmentsResponse { +func NewNullableNetworkGroupAssignmentsResponse( + val *NetworkGroupAssignmentsResponse, +) *NullableNetworkGroupAssignmentsResponse { return &NullableNetworkGroupAssignmentsResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_sensor_group_assignment_response.go b/pkg/config-api-client/model_sensor_group_assignment_response.go index 6ae7f787..b1715e7e 100644 --- a/pkg/config-api-client/model_sensor_group_assignment_response.go +++ b/pkg/config-api-client/model_sensor_group_assignment_response.go @@ -34,7 +34,12 @@ type _SensorGroupAssignmentResponse SensorGroupAssignmentResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSensorGroupAssignmentResponse(id string, group Group, sensor Sensor, type_ string) *SensorGroupAssignmentResponse { +func NewSensorGroupAssignmentResponse( + id string, + group Group, + sensor Sensor, + type_ string, +) *SensorGroupAssignmentResponse { this := SensorGroupAssignmentResponse{} this.Id = id this.Group = group @@ -227,7 +232,9 @@ func (v *NullableSensorGroupAssignmentResponse) Unset() { v.isSet = false } -func NewNullableSensorGroupAssignmentResponse(val *SensorGroupAssignmentResponse) *NullableSensorGroupAssignmentResponse { +func NewNullableSensorGroupAssignmentResponse( + val *SensorGroupAssignmentResponse, +) *NullableSensorGroupAssignmentResponse { return &NullableSensorGroupAssignmentResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_sensor_group_assignments_item.go b/pkg/config-api-client/model_sensor_group_assignments_item.go index 4e93649f..f073511a 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_item.go +++ b/pkg/config-api-client/model_sensor_group_assignments_item.go @@ -34,7 +34,12 @@ type _SensorGroupAssignmentsItem SensorGroupAssignmentsItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSensorGroupAssignmentsItem(id string, group Group, sensor Sensor, type_ string) *SensorGroupAssignmentsItem { +func NewSensorGroupAssignmentsItem( + id string, + group Group, + sensor Sensor, + type_ string, +) *SensorGroupAssignmentsItem { this := SensorGroupAssignmentsItem{} this.Id = id this.Group = group @@ -227,7 +232,9 @@ func (v *NullableSensorGroupAssignmentsItem) Unset() { v.isSet = false } -func NewNullableSensorGroupAssignmentsItem(val *SensorGroupAssignmentsItem) *NullableSensorGroupAssignmentsItem { +func NewNullableSensorGroupAssignmentsItem( + val *SensorGroupAssignmentsItem, +) *NullableSensorGroupAssignmentsItem { return &NullableSensorGroupAssignmentsItem{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_sensor_group_assignments_post_request.go b/pkg/config-api-client/model_sensor_group_assignments_post_request.go index 6dc18945..e9bf8fbb 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_post_request.go +++ b/pkg/config-api-client/model_sensor_group_assignments_post_request.go @@ -32,7 +32,10 @@ type _SensorGroupAssignmentsPostRequest SensorGroupAssignmentsPostRequest // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSensorGroupAssignmentsPostRequest(groupId string, sensorId string) *SensorGroupAssignmentsPostRequest { +func NewSensorGroupAssignmentsPostRequest( + groupId string, + sensorId string, +) *SensorGroupAssignmentsPostRequest { this := SensorGroupAssignmentsPostRequest{} this.GroupId = groupId this.SensorId = sensorId @@ -171,7 +174,9 @@ func (v *NullableSensorGroupAssignmentsPostRequest) Unset() { v.isSet = false } -func NewNullableSensorGroupAssignmentsPostRequest(val *SensorGroupAssignmentsPostRequest) *NullableSensorGroupAssignmentsPostRequest { +func NewNullableSensorGroupAssignmentsPostRequest( + val *SensorGroupAssignmentsPostRequest, +) *NullableSensorGroupAssignmentsPostRequest { return &NullableSensorGroupAssignmentsPostRequest{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_sensor_group_assignments_response.go b/pkg/config-api-client/model_sensor_group_assignments_response.go index 5486c142..6e9e1e5c 100644 --- a/pkg/config-api-client/model_sensor_group_assignments_response.go +++ b/pkg/config-api-client/model_sensor_group_assignments_response.go @@ -33,7 +33,11 @@ type _SensorGroupAssignmentsResponse SensorGroupAssignmentsResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSensorGroupAssignmentsResponse(items []SensorGroupAssignmentsItem, count int32, next NullableString) *SensorGroupAssignmentsResponse { +func NewSensorGroupAssignmentsResponse( + items []SensorGroupAssignmentsItem, + count int32, + next NullableString, +) *SensorGroupAssignmentsResponse { this := SensorGroupAssignmentsResponse{} this.Items = items this.Count = count @@ -201,7 +205,9 @@ func (v *NullableSensorGroupAssignmentsResponse) Unset() { v.isSet = false } -func NewNullableSensorGroupAssignmentsResponse(val *SensorGroupAssignmentsResponse) *NullableSensorGroupAssignmentsResponse { +func NewNullableSensorGroupAssignmentsResponse( + val *SensorGroupAssignmentsResponse, +) *NullableSensorGroupAssignmentsResponse { return &NullableSensorGroupAssignmentsResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_sensor_item.go b/pkg/config-api-client/model_sensor_item.go index a7da6742..409bb73a 100644 --- a/pkg/config-api-client/model_sensor_item.go +++ b/pkg/config-api-client/model_sensor_item.go @@ -42,7 +42,20 @@ type _SensorItem SensorItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSensorItem(id string, serial string, name string, modelNumber string, wifiMacAddress NullableString, ethernetMacAddress NullableString, addressNote NullableString, longitude NullableFloat32, latitude NullableFloat32, notes NullableString, pcapMode NullableString, type_ string) *SensorItem { +func NewSensorItem( + id string, + serial string, + name string, + modelNumber string, + wifiMacAddress NullableString, + ethernetMacAddress NullableString, + addressNote NullableString, + longitude NullableFloat32, + latitude NullableFloat32, + notes NullableString, + pcapMode NullableString, + type_ string, +) *SensorItem { this := SensorItem{} this.Id = id this.Serial = serial diff --git a/pkg/config-api-client/model_sensors_patch_response.go b/pkg/config-api-client/model_sensors_patch_response.go index eb8161df..0424e853 100644 --- a/pkg/config-api-client/model_sensors_patch_response.go +++ b/pkg/config-api-client/model_sensors_patch_response.go @@ -42,7 +42,20 @@ type _SensorsPatchResponse SensorsPatchResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSensorsPatchResponse(id string, serial string, name string, modelNumber string, wifiMacAddress NullableString, ethernetMacAddress NullableString, addressNote NullableString, longitude NullableFloat32, latitude NullableFloat32, notes NullableString, pcapMode NullableString, type_ string) *SensorsPatchResponse { +func NewSensorsPatchResponse( + id string, + serial string, + name string, + modelNumber string, + wifiMacAddress NullableString, + ethernetMacAddress NullableString, + addressNote NullableString, + longitude NullableFloat32, + latitude NullableFloat32, + notes NullableString, + pcapMode NullableString, + type_ string, +) *SensorsPatchResponse { this := SensorsPatchResponse{} this.Id = id this.Serial = serial diff --git a/pkg/config-api-client/model_service_test_group_assignments_post_request.go b/pkg/config-api-client/model_service_test_group_assignments_post_request.go index d961bedb..cfbd0f81 100644 --- a/pkg/config-api-client/model_service_test_group_assignments_post_request.go +++ b/pkg/config-api-client/model_service_test_group_assignments_post_request.go @@ -32,7 +32,10 @@ type _ServiceTestGroupAssignmentsPostRequest ServiceTestGroupAssignmentsPostRequ // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewServiceTestGroupAssignmentsPostRequest(groupId string, serviceTestId string) *ServiceTestGroupAssignmentsPostRequest { +func NewServiceTestGroupAssignmentsPostRequest( + groupId string, + serviceTestId string, +) *ServiceTestGroupAssignmentsPostRequest { this := ServiceTestGroupAssignmentsPostRequest{} this.GroupId = groupId this.ServiceTestId = serviceTestId @@ -157,7 +160,9 @@ func (v NullableServiceTestGroupAssignmentsPostRequest) Get() *ServiceTestGroupA return v.value } -func (v *NullableServiceTestGroupAssignmentsPostRequest) Set(val *ServiceTestGroupAssignmentsPostRequest) { +func (v *NullableServiceTestGroupAssignmentsPostRequest) Set( + val *ServiceTestGroupAssignmentsPostRequest, +) { v.value = val v.isSet = true } @@ -171,7 +176,9 @@ func (v *NullableServiceTestGroupAssignmentsPostRequest) Unset() { v.isSet = false } -func NewNullableServiceTestGroupAssignmentsPostRequest(val *ServiceTestGroupAssignmentsPostRequest) *NullableServiceTestGroupAssignmentsPostRequest { +func NewNullableServiceTestGroupAssignmentsPostRequest( + val *ServiceTestGroupAssignmentsPostRequest, +) *NullableServiceTestGroupAssignmentsPostRequest { return &NullableServiceTestGroupAssignmentsPostRequest{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_service_test_group_assignments_post_response.go b/pkg/config-api-client/model_service_test_group_assignments_post_response.go index 8785d545..4d57be50 100644 --- a/pkg/config-api-client/model_service_test_group_assignments_post_response.go +++ b/pkg/config-api-client/model_service_test_group_assignments_post_response.go @@ -34,7 +34,12 @@ type _ServiceTestGroupAssignmentsPostResponse ServiceTestGroupAssignmentsPostRes // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewServiceTestGroupAssignmentsPostResponse(id string, group Group, serviceTest ServiceTest, type_ string) *ServiceTestGroupAssignmentsPostResponse { +func NewServiceTestGroupAssignmentsPostResponse( + id string, + group Group, + serviceTest ServiceTest, + type_ string, +) *ServiceTestGroupAssignmentsPostResponse { this := ServiceTestGroupAssignmentsPostResponse{} this.Id = id this.Group = group @@ -213,7 +218,9 @@ func (v NullableServiceTestGroupAssignmentsPostResponse) Get() *ServiceTestGroup return v.value } -func (v *NullableServiceTestGroupAssignmentsPostResponse) Set(val *ServiceTestGroupAssignmentsPostResponse) { +func (v *NullableServiceTestGroupAssignmentsPostResponse) Set( + val *ServiceTestGroupAssignmentsPostResponse, +) { v.value = val v.isSet = true } @@ -227,7 +234,9 @@ func (v *NullableServiceTestGroupAssignmentsPostResponse) Unset() { v.isSet = false } -func NewNullableServiceTestGroupAssignmentsPostResponse(val *ServiceTestGroupAssignmentsPostResponse) *NullableServiceTestGroupAssignmentsPostResponse { +func NewNullableServiceTestGroupAssignmentsPostResponse( + val *ServiceTestGroupAssignmentsPostResponse, +) *NullableServiceTestGroupAssignmentsPostResponse { return &NullableServiceTestGroupAssignmentsPostResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_service_tests_list_item.go b/pkg/config-api-client/model_service_tests_list_item.go index 5e23ac0a..55a1d835 100644 --- a/pkg/config-api-client/model_service_tests_list_item.go +++ b/pkg/config-api-client/model_service_tests_list_item.go @@ -37,7 +37,15 @@ type _ServiceTestsListItem ServiceTestsListItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewServiceTestsListItem(id string, category string, name string, target NullableString, template string, isEnabled bool, type_ string) *ServiceTestsListItem { +func NewServiceTestsListItem( + id string, + category string, + name string, + target NullableString, + template string, + isEnabled bool, + type_ string, +) *ServiceTestsListItem { this := ServiceTestsListItem{} this.Id = id this.Category = category diff --git a/pkg/config-api-client/model_service_tests_list_response.go b/pkg/config-api-client/model_service_tests_list_response.go index bfc6c65d..0d4cbd9b 100644 --- a/pkg/config-api-client/model_service_tests_list_response.go +++ b/pkg/config-api-client/model_service_tests_list_response.go @@ -33,7 +33,11 @@ type _ServiceTestsListResponse ServiceTestsListResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewServiceTestsListResponse(items []ServiceTestsListItem, count int32, next NullableString) *ServiceTestsListResponse { +func NewServiceTestsListResponse( + items []ServiceTestsListItem, + count int32, + next NullableString, +) *ServiceTestsListResponse { this := ServiceTestsListResponse{} this.Items = items this.Count = count @@ -201,7 +205,9 @@ func (v *NullableServiceTestsListResponse) Unset() { v.isSet = false } -func NewNullableServiceTestsListResponse(val *ServiceTestsListResponse) *NullableServiceTestsListResponse { +func NewNullableServiceTestsListResponse( + val *ServiceTestsListResponse, +) *NullableServiceTestsListResponse { return &NullableServiceTestsListResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/model_wired_networks_item.go b/pkg/config-api-client/model_wired_networks_item.go index c19d3801..668c6209 100644 --- a/pkg/config-api-client/model_wired_networks_item.go +++ b/pkg/config-api-client/model_wired_networks_item.go @@ -43,7 +43,20 @@ type _WiredNetworksItem WiredNetworksItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewWiredNetworksItem(id string, name string, ipVersion string, createdAt time.Time, updatedAt time.Time, security NullableString, dnsLookupDomain NullableString, disableEdns bool, useDns64 bool, externalConnectivity bool, vLanId NullableInt32, type_ string) *WiredNetworksItem { +func NewWiredNetworksItem( + id string, + name string, + ipVersion string, + createdAt time.Time, + updatedAt time.Time, + security NullableString, + dnsLookupDomain NullableString, + disableEdns bool, + useDns64 bool, + externalConnectivity bool, + vLanId NullableInt32, + type_ string, +) *WiredNetworksItem { this := WiredNetworksItem{} this.Id = id this.Name = name diff --git a/pkg/config-api-client/model_wired_networks_response.go b/pkg/config-api-client/model_wired_networks_response.go index 19b2e81d..c9632c18 100644 --- a/pkg/config-api-client/model_wired_networks_response.go +++ b/pkg/config-api-client/model_wired_networks_response.go @@ -33,7 +33,11 @@ type _WiredNetworksResponse WiredNetworksResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewWiredNetworksResponse(items []WiredNetworksItem, count int32, next NullableString) *WiredNetworksResponse { +func NewWiredNetworksResponse( + items []WiredNetworksItem, + count int32, + next NullableString, +) *WiredNetworksResponse { this := WiredNetworksResponse{} this.Items = items this.Count = count diff --git a/pkg/config-api-client/model_wireless_networks_item.go b/pkg/config-api-client/model_wireless_networks_item.go index 686f4676..5cf357b3 100644 --- a/pkg/config-api-client/model_wireless_networks_item.go +++ b/pkg/config-api-client/model_wireless_networks_item.go @@ -45,7 +45,22 @@ type _WirelessNetworksItem WirelessNetworksItem // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewWirelessNetworksItem(id string, name string, ssid string, security NullableString, ipVersion string, createdAt time.Time, updatedAt time.Time, hidden bool, bandLocking string, dnsLookupDomain NullableString, disableEdns bool, useDns64 bool, externalConnectivity bool, type_ string) *WirelessNetworksItem { +func NewWirelessNetworksItem( + id string, + name string, + ssid string, + security NullableString, + ipVersion string, + createdAt time.Time, + updatedAt time.Time, + hidden bool, + bandLocking string, + dnsLookupDomain NullableString, + disableEdns bool, + useDns64 bool, + externalConnectivity bool, + type_ string, +) *WirelessNetworksItem { this := WirelessNetworksItem{} this.Id = id this.Name = name diff --git a/pkg/config-api-client/model_wireless_networks_response.go b/pkg/config-api-client/model_wireless_networks_response.go index 97956194..2445fa69 100644 --- a/pkg/config-api-client/model_wireless_networks_response.go +++ b/pkg/config-api-client/model_wireless_networks_response.go @@ -33,7 +33,11 @@ type _WirelessNetworksResponse WirelessNetworksResponse // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewWirelessNetworksResponse(items []WirelessNetworksItem, count int32, next NullableString) *WirelessNetworksResponse { +func NewWirelessNetworksResponse( + items []WirelessNetworksItem, + count int32, + next NullableString, +) *WirelessNetworksResponse { this := WirelessNetworksResponse{} this.Items = items this.Count = count @@ -201,7 +205,9 @@ func (v *NullableWirelessNetworksResponse) Unset() { v.isSet = false } -func NewNullableWirelessNetworksResponse(val *WirelessNetworksResponse) *NullableWirelessNetworksResponse { +func NewNullableWirelessNetworksResponse( + val *WirelessNetworksResponse, +) *NullableWirelessNetworksResponse { return &NullableWirelessNetworksResponse{value: val, isSet: true} } diff --git a/pkg/config-api-client/test/api_configuration_test.go b/pkg/config-api-client/test/api_configuration_test.go index 0bb0764c..6b4c65eb 100644 --- a/pkg/config-api-client/test/api_configuration_test.go +++ b/pkg/config-api-client/test/api_configuration_test.go @@ -587,7 +587,10 @@ func TestConfigurationAPI(t *testing.T) { "type": "networking-uxi/network-group-assignment", }) - postRequest := openapiclient.NewNetworkGroupAssignmentsPostRequest("group_uid", "network_uid") + postRequest := openapiclient.NewNetworkGroupAssignmentsPostRequest( + "group_uid", + "network_uid", + ) resp, httpRes, err := apiClient.ConfigurationAPI. NetworkGroupAssignmentsPost(context.Background()). NetworkGroupAssignmentsPostRequest(*postRequest). @@ -632,7 +635,10 @@ func TestConfigurationAPI(t *testing.T) { "type": "networking-uxi/service-test-group-assignment", }) - postRequest := openapiclient.NewServiceTestGroupAssignmentsPostRequest("group_uid", "service_test_uid") + postRequest := openapiclient.NewServiceTestGroupAssignmentsPostRequest( + "group_uid", + "service_test_uid", + ) resp, httpRes, err := apiClient.ConfigurationAPI. ServiceTestGroupAssignmentsPost(context.Background()). ServiceTestGroupAssignmentsPostRequest(*postRequest). diff --git a/pkg/config-api-client/utils.go b/pkg/config-api-client/utils.go index a953b543..cb5f30c6 100644 --- a/pkg/config-api-client/utils.go +++ b/pkg/config-api-client/utils.go @@ -337,7 +337,13 @@ func IsNil(i interface{}) bool { return true } switch reflect.TypeOf(i).Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + case reflect.Chan, + reflect.Func, + reflect.Map, + reflect.Ptr, + reflect.UnsafePointer, + reflect.Interface, + reflect.Slice: return reflect.ValueOf(i).IsNil() case reflect.Array: return reflect.ValueOf(i).IsZero() diff --git a/pkg/config-api-provider/main.go b/pkg/config-api-provider/main.go index 30ce9153..86ff5d77 100644 --- a/pkg/config-api-provider/main.go +++ b/pkg/config-api-provider/main.go @@ -19,7 +19,12 @@ var ( func main() { var debug bool - flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve") + flag.BoolVar( + &debug, + "debug", + false, + "set to true to run the provider with support for debuggers like delve", + ) flag.Parse() opts := providerserver.ServeOpts{ diff --git a/pkg/config-api-provider/provider/data-sources/agent.go b/pkg/config-api-provider/provider/data-sources/agent.go index 490138f8..18a64333 100644 --- a/pkg/config-api-provider/provider/data-sources/agent.go +++ b/pkg/config-api-provider/provider/data-sources/agent.go @@ -40,11 +40,19 @@ type agentDataSourceModel struct { } `tfsdk:"filter"` } -func (d *agentDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *agentDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_agent" } -func (d *agentDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *agentDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -92,7 +100,11 @@ func (d *agentDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, } } -func (d *agentDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *agentDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state agentDataSourceModel // Read configuration from request @@ -139,7 +151,11 @@ func (d *agentDataSource) Read(ctx context.Context, req datasource.ReadRequest, } } -func (d *agentDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *agentDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { diff --git a/pkg/config-api-provider/provider/data-sources/group.go b/pkg/config-api-provider/provider/data-sources/group.go index 73476b72..0dffd5ad 100644 --- a/pkg/config-api-provider/provider/data-sources/group.go +++ b/pkg/config-api-provider/provider/data-sources/group.go @@ -33,11 +33,19 @@ type groupDataSourceModel struct { } `tfsdk:"filter"` } -func (d *groupDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *groupDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_group" } -func (d *groupDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *groupDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -64,7 +72,11 @@ func (d *groupDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, } } -func (d *groupDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *groupDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state groupDataSourceModel // Read configuration from request @@ -112,7 +124,11 @@ func (d *groupDataSource) Read(ctx context.Context, req datasource.ReadRequest, } } -func (d *groupDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *groupDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { diff --git a/pkg/config-api-provider/provider/data-sources/network_group_assignment.go b/pkg/config-api-provider/provider/data-sources/network_group_assignment.go index 36b6f279..17f2b058 100644 --- a/pkg/config-api-provider/provider/data-sources/network_group_assignment.go +++ b/pkg/config-api-provider/provider/data-sources/network_group_assignment.go @@ -32,11 +32,19 @@ type networkGroupAssignmentDataSourceModel struct { } `tfsdk:"filter"` } -func (d *networkGroupAssignmentDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *networkGroupAssignmentDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_network_group_assignment" } -func (d *networkGroupAssignmentDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *networkGroupAssignmentDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -60,7 +68,11 @@ func (d *networkGroupAssignmentDataSource) Schema(_ context.Context, _ datasourc } } -func (d *networkGroupAssignmentDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *networkGroupAssignmentDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state networkGroupAssignmentDataSourceModel diags := req.Config.Get(ctx, &state) @@ -99,7 +111,11 @@ func (d *networkGroupAssignmentDataSource) Read(ctx context.Context, req datasou } } -func (d *networkGroupAssignmentDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *networkGroupAssignmentDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { if req.ProviderData == nil { return } diff --git a/pkg/config-api-provider/provider/data-sources/sensor.go b/pkg/config-api-provider/provider/data-sources/sensor.go index 25f624fa..74ad3557 100644 --- a/pkg/config-api-provider/provider/data-sources/sensor.go +++ b/pkg/config-api-provider/provider/data-sources/sensor.go @@ -40,11 +40,19 @@ type sensorDataSourceModel struct { } `tfsdk:"filter"` } -func (d *sensorDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *sensorDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_sensor" } -func (d *sensorDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *sensorDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -92,7 +100,11 @@ func (d *sensorDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, } } -func (d *sensorDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *sensorDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state sensorDataSourceModel // Read configuration from request @@ -142,7 +154,11 @@ func (d *sensorDataSource) Read(ctx context.Context, req datasource.ReadRequest, } } -func (d *sensorDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *sensorDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { diff --git a/pkg/config-api-provider/provider/data-sources/sensor_group_assignment.go b/pkg/config-api-provider/provider/data-sources/sensor_group_assignment.go index 2b2a08af..8c08841c 100644 --- a/pkg/config-api-provider/provider/data-sources/sensor_group_assignment.go +++ b/pkg/config-api-provider/provider/data-sources/sensor_group_assignment.go @@ -33,11 +33,19 @@ type sensorGroupAssignmentDataSourceModel struct { } `tfsdk:"filter"` } -func (d *sensorGroupAssignmentDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *sensorGroupAssignmentDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_sensor_group_assignment" } -func (d *sensorGroupAssignmentDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *sensorGroupAssignmentDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -61,7 +69,11 @@ func (d *sensorGroupAssignmentDataSource) Schema(_ context.Context, _ datasource } } -func (d *sensorGroupAssignmentDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *sensorGroupAssignmentDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state sensorGroupAssignmentDataSourceModel // Read configuration from request @@ -102,7 +114,11 @@ func (d *sensorGroupAssignmentDataSource) Read(ctx context.Context, req datasour } } -func (d *sensorGroupAssignmentDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *sensorGroupAssignmentDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { diff --git a/pkg/config-api-provider/provider/data-sources/wired_network.go b/pkg/config-api-provider/provider/data-sources/wired_network.go index b75cff07..f0e5869e 100644 --- a/pkg/config-api-provider/provider/data-sources/wired_network.go +++ b/pkg/config-api-provider/provider/data-sources/wired_network.go @@ -40,11 +40,19 @@ type wiredNetworkDataSourceModel struct { } `tfsdk:"filter"` } -func (d *wiredNetworkDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *wiredNetworkDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_wired_network" } -func (d *wiredNetworkDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *wiredNetworkDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -86,7 +94,11 @@ func (d *wiredNetworkDataSource) Schema(_ context.Context, _ datasource.SchemaRe } } -func (d *wiredNetworkDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *wiredNetworkDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state wiredNetworkDataSourceModel // Read configuration from request @@ -133,7 +145,11 @@ func (d *wiredNetworkDataSource) Read(ctx context.Context, req datasource.ReadRe } } -func (d *wiredNetworkDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *wiredNetworkDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { diff --git a/pkg/config-api-provider/provider/data-sources/wireless_network.go b/pkg/config-api-provider/provider/data-sources/wireless_network.go index 8e8b672a..e9bdb04e 100644 --- a/pkg/config-api-provider/provider/data-sources/wireless_network.go +++ b/pkg/config-api-provider/provider/data-sources/wireless_network.go @@ -42,11 +42,19 @@ type wirelessNetworkDataSourceModel struct { } `tfsdk:"filter"` } -func (d *wirelessNetworkDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { +func (d *wirelessNetworkDataSource) Metadata( + _ context.Context, + req datasource.MetadataRequest, + resp *datasource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_wireless_network" } -func (d *wirelessNetworkDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { +func (d *wirelessNetworkDataSource) Schema( + _ context.Context, + _ datasource.SchemaRequest, + resp *datasource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -94,7 +102,11 @@ func (d *wirelessNetworkDataSource) Schema(_ context.Context, _ datasource.Schem } } -func (d *wirelessNetworkDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { +func (d *wirelessNetworkDataSource) Read( + ctx context.Context, + req datasource.ReadRequest, + resp *datasource.ReadResponse, +) { var state wirelessNetworkDataSourceModel // Read configuration from request @@ -143,7 +155,11 @@ func (d *wirelessNetworkDataSource) Read(ctx context.Context, req datasource.Rea } } -func (d *wirelessNetworkDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { +func (d *wirelessNetworkDataSource) Configure( + _ context.Context, + req datasource.ConfigureRequest, + resp *datasource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { diff --git a/pkg/config-api-provider/provider/provider.go b/pkg/config-api-provider/provider/provider.go index 7f9ae59e..1032f40c 100644 --- a/pkg/config-api-provider/provider/provider.go +++ b/pkg/config-api-provider/provider/provider.go @@ -52,13 +52,21 @@ type uxiConfigurationProvider struct { } // Metadata returns the provider type name. -func (p *uxiConfigurationProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse) { +func (p *uxiConfigurationProvider) Metadata( + _ context.Context, + _ provider.MetadataRequest, + resp *provider.MetadataResponse, +) { resp.TypeName = "uxi" resp.Version = p.version } // Schema defines the provider-level schema for configuration data. -func (p *uxiConfigurationProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) { +func (p *uxiConfigurationProvider) Schema( + _ context.Context, + _ provider.SchemaRequest, + resp *provider.SchemaResponse, +) { resp.Schema = schema.Schema{Attributes: map[string]schema.Attribute{ "host": schema.StringAttribute{Optional: true}, "client_id": schema.StringAttribute{Optional: true}, @@ -69,7 +77,11 @@ func (p *uxiConfigurationProvider) Schema(_ context.Context, _ provider.SchemaRe // TODO: Obtain a greenlake access token // Configure prepares a Configuration API client for data sources and resources. -func (p *uxiConfigurationProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { +func (p *uxiConfigurationProvider) Configure( + ctx context.Context, + req provider.ConfigureRequest, + resp *provider.ConfigureResponse, +) { // Init var config uxiProviderModel diags := req.Config.Get(ctx, &config) diff --git a/pkg/config-api-provider/provider/resources/agent.go b/pkg/config-api-provider/provider/resources/agent.go index 29598c3b..c622dba1 100644 --- a/pkg/config-api-provider/provider/resources/agent.go +++ b/pkg/config-api-provider/provider/resources/agent.go @@ -54,11 +54,19 @@ type agentResource struct { client *config_api_client.APIClient } -func (r *agentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *agentResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_agent" } -func (r *agentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *agentResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -80,7 +88,11 @@ func (r *agentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp } } -func (r *agentResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *agentResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { @@ -100,15 +112,26 @@ func (r *agentResource) Configure(_ context.Context, req resource.ConfigureReque r.client = client } -func (r *agentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *agentResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan agentResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "creating an agent is not supported; agents can only be imported") + diags.AddError( + "operation not supported", + "creating an agent is not supported; agents can only be imported", + ) resp.Diagnostics.Append(diags...) } -func (r *agentResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *agentResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { var state agentResourceModel diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -146,7 +169,11 @@ func (r *agentResource) Read(ctx context.Context, req resource.ReadRequest, resp } } -func (r *agentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *agentResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan agentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -175,7 +202,11 @@ func (r *agentResource) Update(ctx context.Context, req resource.UpdateRequest, } } -func (r *agentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *agentResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state agentResourceModel diags := req.State.Get(ctx, &state) @@ -188,7 +219,11 @@ func (r *agentResource) Delete(ctx context.Context, req resource.DeleteRequest, // err := r.client.DeleteOrder(state.ID.ValueString()) } -func (r *agentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *agentResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/agent_group_assignment.go b/pkg/config-api-provider/provider/resources/agent_group_assignment.go index 57e469e2..7af729fd 100644 --- a/pkg/config-api-provider/provider/resources/agent_group_assignment.go +++ b/pkg/config-api-provider/provider/resources/agent_group_assignment.go @@ -40,11 +40,19 @@ func NewAgentGroupAssignmentResource() resource.Resource { type agentGroupAssignmentResource struct{} -func (r *agentGroupAssignmentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *agentGroupAssignmentResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_agent_group_assignment" } -func (r *agentGroupAssignmentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *agentGroupAssignmentResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -69,10 +77,18 @@ func (r *agentGroupAssignmentResource) Schema(_ context.Context, _ resource.Sche } } -func (r *agentGroupAssignmentResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *agentGroupAssignmentResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { } -func (r *agentGroupAssignmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *agentGroupAssignmentResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan agentGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -100,7 +116,11 @@ func (r *agentGroupAssignmentResource) Create(ctx context.Context, req resource. } } -func (r *agentGroupAssignmentResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *agentGroupAssignmentResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state agentGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -124,7 +144,11 @@ func (r *agentGroupAssignmentResource) Read(ctx context.Context, req resource.Re } } -func (r *agentGroupAssignmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *agentGroupAssignmentResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan agentGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -135,7 +159,11 @@ func (r *agentGroupAssignmentResource) Update(ctx context.Context, req resource. } } -func (r *agentGroupAssignmentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *agentGroupAssignmentResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state agentGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -147,7 +175,11 @@ func (r *agentGroupAssignmentResource) Delete(ctx context.Context, req resource. // Delete existing agentGroupAssignment using the plan_id } -func (r *agentGroupAssignmentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *agentGroupAssignmentResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/group.go b/pkg/config-api-provider/provider/resources/group.go index 6a53854e..cc6c715a 100644 --- a/pkg/config-api-provider/provider/resources/group.go +++ b/pkg/config-api-provider/provider/resources/group.go @@ -34,11 +34,19 @@ type groupResource struct { client *config_api_client.APIClient } -func (r *groupResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *groupResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_group" } -func (r *groupResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *groupResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -62,7 +70,11 @@ func (r *groupResource) Schema(_ context.Context, _ resource.SchemaRequest, resp } } -func (r *groupResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *groupResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { @@ -82,7 +94,11 @@ func (r *groupResource) Configure(_ context.Context, req resource.ConfigureReque r.client = client } -func (r *groupResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *groupResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan groupResourceModel diags := req.Plan.Get(ctx, &plan) @@ -119,7 +135,11 @@ func (r *groupResource) Create(ctx context.Context, req resource.CreateRequest, } } -func (r *groupResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *groupResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state groupResourceModel diags := req.State.Get(ctx, &state) @@ -164,7 +184,11 @@ func (r *groupResource) Read(ctx context.Context, req resource.ReadRequest, resp } } -func (r *groupResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *groupResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan groupResourceModel diags := req.Plan.Get(ctx, &plan) @@ -198,7 +222,11 @@ func (r *groupResource) Update(ctx context.Context, req resource.UpdateRequest, } } -func (r *groupResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *groupResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state groupResourceModel diags := req.State.Get(ctx, &state) @@ -219,6 +247,10 @@ func (r *groupResource) Delete(ctx context.Context, req resource.DeleteRequest, } } -func (r *groupResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *groupResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/network_group_assignment.go b/pkg/config-api-provider/provider/resources/network_group_assignment.go index af22e974..dd7552c0 100644 --- a/pkg/config-api-provider/provider/resources/network_group_assignment.go +++ b/pkg/config-api-provider/provider/resources/network_group_assignment.go @@ -33,11 +33,19 @@ type networkGroupAssignmentResource struct { client *config_api_client.APIClient } -func (r *networkGroupAssignmentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *networkGroupAssignmentResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_network_group_assignment" } -func (r *networkGroupAssignmentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *networkGroupAssignmentResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -62,7 +70,11 @@ func (r *networkGroupAssignmentResource) Schema(_ context.Context, _ resource.Sc } } -func (r *networkGroupAssignmentResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *networkGroupAssignmentResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { if req.ProviderData == nil { return } @@ -80,7 +92,11 @@ func (r *networkGroupAssignmentResource) Configure(_ context.Context, req resour r.client = client } -func (r *networkGroupAssignmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *networkGroupAssignmentResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan networkGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -100,7 +116,10 @@ func (r *networkGroupAssignmentResource) Create(ctx context.Context, req resourc errorPresent, errorDetail := util.RaiseForStatus(response, err) if errorPresent { - resp.Diagnostics.AddError(util.GenerateErrorSummary("create", "uxi_network_group_assignment"), errorDetail) + resp.Diagnostics.AddError( + util.GenerateErrorSummary("create", "uxi_network_group_assignment"), + errorDetail, + ) return } @@ -117,7 +136,11 @@ func (r *networkGroupAssignmentResource) Create(ctx context.Context, req resourc } } -func (r *networkGroupAssignmentResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *networkGroupAssignmentResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state networkGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -157,18 +180,29 @@ func (r *networkGroupAssignmentResource) Read(ctx context.Context, req resource. } } -func (r *networkGroupAssignmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *networkGroupAssignmentResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan networkGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "updating a network group assignment is not supported") + diags.AddError( + "operation not supported", + "updating a network group assignment is not supported", + ) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return } } -func (r *networkGroupAssignmentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *networkGroupAssignmentResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state networkGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -183,11 +217,18 @@ func (r *networkGroupAssignmentResource) Delete(ctx context.Context, req resourc errorPresent, errorDetail := util.RaiseForStatus(response, err) if errorPresent { - resp.Diagnostics.AddError(util.GenerateErrorSummary("delete", "uxi_network_group_assignment"), errorDetail) + resp.Diagnostics.AddError( + util.GenerateErrorSummary("delete", "uxi_network_group_assignment"), + errorDetail, + ) return } } -func (r *networkGroupAssignmentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *networkGroupAssignmentResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/sensor.go b/pkg/config-api-provider/provider/resources/sensor.go index 725f3159..58d23144 100644 --- a/pkg/config-api-provider/provider/resources/sensor.go +++ b/pkg/config-api-provider/provider/resources/sensor.go @@ -58,11 +58,19 @@ type sensorResource struct { client *config_api_client.APIClient } -func (r *sensorResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *sensorResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_sensor" } -func (r *sensorResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *sensorResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -87,7 +95,11 @@ func (r *sensorResource) Schema(_ context.Context, _ resource.SchemaRequest, res } } -func (r *sensorResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *sensorResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { @@ -107,15 +119,26 @@ func (r *sensorResource) Configure(_ context.Context, req resource.ConfigureRequ r.client = client } -func (r *sensorResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *sensorResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan sensorResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "creating a sensor is not supported; sensors can only be imported") + diags.AddError( + "operation not supported", + "creating a sensor is not supported; sensors can only be imported", + ) resp.Diagnostics.Append(diags...) } -func (r *sensorResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *sensorResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state sensorResourceModel diags := req.State.Get(ctx, &state) @@ -157,7 +180,11 @@ func (r *sensorResource) Read(ctx context.Context, req resource.ReadRequest, res } } -func (r *sensorResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *sensorResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan sensorResourceModel diags := req.Plan.Get(ctx, &plan) @@ -188,15 +215,26 @@ func (r *sensorResource) Update(ctx context.Context, req resource.UpdateRequest, } } -func (r *sensorResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *sensorResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state sensorResourceModel diags := req.State.Get(ctx, &state) - diags.AddError("operation not supported", "deleting a sensor is not supported; sensors can only removed from state") + diags.AddError( + "operation not supported", + "deleting a sensor is not supported; sensors can only removed from state", + ) resp.Diagnostics.Append(diags...) } -func (r *sensorResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *sensorResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/sensor_group_assignment.go b/pkg/config-api-provider/provider/resources/sensor_group_assignment.go index f5bc99ff..6f4fd945 100644 --- a/pkg/config-api-provider/provider/resources/sensor_group_assignment.go +++ b/pkg/config-api-provider/provider/resources/sensor_group_assignment.go @@ -38,11 +38,19 @@ type sensorGroupAssignmentResource struct { client *config_api_client.APIClient } -func (r *sensorGroupAssignmentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *sensorGroupAssignmentResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_sensor_group_assignment" } -func (r *sensorGroupAssignmentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *sensorGroupAssignmentResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -67,7 +75,11 @@ func (r *sensorGroupAssignmentResource) Schema(_ context.Context, _ resource.Sch } } -func (r *sensorGroupAssignmentResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *sensorGroupAssignmentResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { @@ -88,7 +100,11 @@ func (r *sensorGroupAssignmentResource) Configure(_ context.Context, req resourc } -func (r *sensorGroupAssignmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *sensorGroupAssignmentResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan sensorGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -97,7 +113,10 @@ func (r *sensorGroupAssignmentResource) Create(ctx context.Context, req resource return } - postRequest := config_api_client.NewSensorGroupAssignmentsPostRequest(plan.GroupID.ValueString(), plan.SensorID.ValueString()) + postRequest := config_api_client.NewSensorGroupAssignmentsPostRequest( + plan.GroupID.ValueString(), + plan.SensorID.ValueString(), + ) request := r.client.ConfigurationAPI. SensorGroupAssignmentsPost(ctx). SensorGroupAssignmentsPostRequest(*postRequest) @@ -105,7 +124,10 @@ func (r *sensorGroupAssignmentResource) Create(ctx context.Context, req resource errorPresent, errorDetail := util.RaiseForStatus(response, err) if errorPresent { - resp.Diagnostics.AddError(util.GenerateErrorSummary("create", "uxi_sensor_group_assignment"), errorDetail) + resp.Diagnostics.AddError( + util.GenerateErrorSummary("create", "uxi_sensor_group_assignment"), + errorDetail, + ) return } @@ -120,7 +142,11 @@ func (r *sensorGroupAssignmentResource) Create(ctx context.Context, req resource } } -func (r *sensorGroupAssignmentResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *sensorGroupAssignmentResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state sensorGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -161,7 +187,11 @@ func (r *sensorGroupAssignmentResource) Read(ctx context.Context, req resource.R } } -func (r *sensorGroupAssignmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *sensorGroupAssignmentResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan sensorGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -172,7 +202,11 @@ func (r *sensorGroupAssignmentResource) Update(ctx context.Context, req resource } } -func (r *sensorGroupAssignmentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *sensorGroupAssignmentResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state sensorGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -188,11 +222,18 @@ func (r *sensorGroupAssignmentResource) Delete(ctx context.Context, req resource errorPresent, errorDetail := util.RaiseForStatus(response, err) if errorPresent { - resp.Diagnostics.AddError(util.GenerateErrorSummary("delete", "uxi_sensor_group_assignment"), errorDetail) + resp.Diagnostics.AddError( + util.GenerateErrorSummary("delete", "uxi_sensor_group_assignment"), + errorDetail, + ) return } } -func (r *sensorGroupAssignmentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *sensorGroupAssignmentResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/service.go b/pkg/config-api-provider/provider/resources/service.go index e3990cdf..120dc5e8 100644 --- a/pkg/config-api-provider/provider/resources/service.go +++ b/pkg/config-api-provider/provider/resources/service.go @@ -39,11 +39,19 @@ func NewServiceTestResource() resource.Resource { type serviceTestResource struct{} -func (r *serviceTestResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *serviceTestResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_service_test" } -func (r *serviceTestResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *serviceTestResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -59,18 +67,33 @@ func (r *serviceTestResource) Schema(_ context.Context, _ resource.SchemaRequest } } -func (r *serviceTestResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *serviceTestResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { } -func (r *serviceTestResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *serviceTestResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan serviceTestResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "creating a service_test is not supported; service_tests can only be imported") + diags.AddError( + "operation not supported", + "creating a service_test is not supported; service_tests can only be imported", + ) resp.Diagnostics.Append(diags...) } -func (r *serviceTestResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *serviceTestResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state serviceTestResourceModel diags := req.State.Get(ctx, &state) @@ -92,23 +115,41 @@ func (r *serviceTestResource) Read(ctx context.Context, req resource.ReadRequest } } -func (r *serviceTestResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *serviceTestResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan serviceTestResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "updating a service_test is not supported; service_tests can only be updated through the dashboard") + diags.AddError( + "operation not supported", + "updating a service_test is not supported; service_tests can only be updated through the dashboard", + ) resp.Diagnostics.Append(diags...) } -func (r *serviceTestResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *serviceTestResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state serviceTestResourceModel diags := req.State.Get(ctx, &state) - diags.AddError("operation not supported", "deleting a service_test is not supported; service_tests can only removed from state") + diags.AddError( + "operation not supported", + "deleting a service_test is not supported; service_tests can only removed from state", + ) resp.Diagnostics.Append(diags...) } -func (r *serviceTestResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *serviceTestResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/service_group_assignment.go b/pkg/config-api-provider/provider/resources/service_group_assignment.go index a8c40ecd..6da541bb 100644 --- a/pkg/config-api-provider/provider/resources/service_group_assignment.go +++ b/pkg/config-api-provider/provider/resources/service_group_assignment.go @@ -33,11 +33,19 @@ type serviceTestGroupAssignmentResource struct { client *config_api_client.APIClient } -func (r *serviceTestGroupAssignmentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *serviceTestGroupAssignmentResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_service_test_group_assignment" } -func (r *serviceTestGroupAssignmentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *serviceTestGroupAssignmentResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -62,7 +70,11 @@ func (r *serviceTestGroupAssignmentResource) Schema(_ context.Context, _ resourc } } -func (r *serviceTestGroupAssignmentResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *serviceTestGroupAssignmentResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { if req.ProviderData == nil { return } @@ -80,7 +92,11 @@ func (r *serviceTestGroupAssignmentResource) Configure(_ context.Context, req re r.client = client } -func (r *serviceTestGroupAssignmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *serviceTestGroupAssignmentResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan serviceTestGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) @@ -100,7 +116,10 @@ func (r *serviceTestGroupAssignmentResource) Create(ctx context.Context, req res errorPresent, errorDetail := util.RaiseForStatus(response, err) if errorPresent { - resp.Diagnostics.AddError(util.GenerateErrorSummary("delete", "uxi_service_test_group_assignment"), errorDetail) + resp.Diagnostics.AddError( + util.GenerateErrorSummary("delete", "uxi_service_test_group_assignment"), + errorDetail, + ) return } @@ -117,7 +136,11 @@ func (r *serviceTestGroupAssignmentResource) Create(ctx context.Context, req res } } -func (r *serviceTestGroupAssignmentResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *serviceTestGroupAssignmentResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state serviceTestGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -141,18 +164,29 @@ func (r *serviceTestGroupAssignmentResource) Read(ctx context.Context, req resou } } -func (r *serviceTestGroupAssignmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *serviceTestGroupAssignmentResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan serviceTestGroupAssignmentResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "updating a service_test group assignment is not supported") + diags.AddError( + "operation not supported", + "updating a service_test group assignment is not supported", + ) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return } } -func (r *serviceTestGroupAssignmentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *serviceTestGroupAssignmentResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state serviceTestGroupAssignmentResourceModel diags := req.State.Get(ctx, &state) @@ -168,12 +202,19 @@ func (r *serviceTestGroupAssignmentResource) Delete(ctx context.Context, req res errorPresent, errorDetail := util.RaiseForStatus(response, err) if errorPresent { - resp.Diagnostics.AddError(util.GenerateErrorSummary("delete", "uxi_service_test_group_assignment"), errorDetail) + resp.Diagnostics.AddError( + util.GenerateErrorSummary("delete", "uxi_service_test_group_assignment"), + errorDetail, + ) return } } -func (r *serviceTestGroupAssignmentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *serviceTestGroupAssignmentResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/wired_network.go b/pkg/config-api-provider/provider/resources/wired_network.go index 066dac01..368c46a5 100644 --- a/pkg/config-api-provider/provider/resources/wired_network.go +++ b/pkg/config-api-provider/provider/resources/wired_network.go @@ -32,11 +32,19 @@ type wiredNetworkResource struct { client *config_api_client.APIClient } -func (r *wiredNetworkResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *wiredNetworkResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_wired_network" } -func (r *wiredNetworkResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *wiredNetworkResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -52,7 +60,11 @@ func (r *wiredNetworkResource) Schema(_ context.Context, _ resource.SchemaReques } } -func (r *wiredNetworkResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *wiredNetworkResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { @@ -72,15 +84,26 @@ func (r *wiredNetworkResource) Configure(_ context.Context, req resource.Configu r.client = client } -func (r *wiredNetworkResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *wiredNetworkResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan wiredNetworkResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "creating a wired_network is not supported; wired_networks can only be imported") + diags.AddError( + "operation not supported", + "creating a wired_network is not supported; wired_networks can only be imported", + ) resp.Diagnostics.Append(diags...) } -func (r *wiredNetworkResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *wiredNetworkResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state wiredNetworkResourceModel diags := req.State.Get(ctx, &state) @@ -120,22 +143,40 @@ func (r *wiredNetworkResource) Read(ctx context.Context, req resource.ReadReques } } -func (r *wiredNetworkResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *wiredNetworkResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan wiredNetworkResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "updating a wired_network is not supported; wired_networks can only be updated through the dashboard") + diags.AddError( + "operation not supported", + "updating a wired_network is not supported; wired_networks can only be updated through the dashboard", + ) resp.Diagnostics.Append(diags...) } -func (r *wiredNetworkResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *wiredNetworkResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state wiredNetworkResourceModel diags := req.State.Get(ctx, &state) - diags.AddError("operation not supported", "deleting a wired_network is not supported; wired_networks can only removed from state") + diags.AddError( + "operation not supported", + "deleting a wired_network is not supported; wired_networks can only removed from state", + ) resp.Diagnostics.Append(diags...) } -func (r *wiredNetworkResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *wiredNetworkResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/resources/wireless_network.go b/pkg/config-api-provider/provider/resources/wireless_network.go index ebc84741..be6da395 100644 --- a/pkg/config-api-provider/provider/resources/wireless_network.go +++ b/pkg/config-api-provider/provider/resources/wireless_network.go @@ -32,11 +32,19 @@ type wirelessNetworkResource struct { client *config_api_client.APIClient } -func (r *wirelessNetworkResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { +func (r *wirelessNetworkResource) Metadata( + ctx context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { resp.TypeName = req.ProviderTypeName + "_wireless_network" } -func (r *wirelessNetworkResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { +func (r *wirelessNetworkResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -52,7 +60,11 @@ func (r *wirelessNetworkResource) Schema(_ context.Context, _ resource.SchemaReq } } -func (r *wirelessNetworkResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { +func (r *wirelessNetworkResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { // Add a nil check when handling ProviderData because Terraform // sets that data after it calls the ConfigureProvider RPC. if req.ProviderData == nil { @@ -72,15 +84,26 @@ func (r *wirelessNetworkResource) Configure(_ context.Context, req resource.Conf r.client = client } -func (r *wirelessNetworkResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { +func (r *wirelessNetworkResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { // Retrieve values from plan var plan wirelessNetworkResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "creating a wireless_network is not supported; wireless_networks can only be imported") + diags.AddError( + "operation not supported", + "creating a wireless_network is not supported; wireless_networks can only be imported", + ) resp.Diagnostics.Append(diags...) } -func (r *wirelessNetworkResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { +func (r *wirelessNetworkResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { // Get current state var state wirelessNetworkResourceModel diags := req.State.Get(ctx, &state) @@ -120,22 +143,40 @@ func (r *wirelessNetworkResource) Read(ctx context.Context, req resource.ReadReq } } -func (r *wirelessNetworkResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { +func (r *wirelessNetworkResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { // Retrieve values from plan var plan wirelessNetworkResourceModel diags := req.Plan.Get(ctx, &plan) - diags.AddError("operation not supported", "updating a wireless_network is not supported; wireless_networks can only be updated through the dashboard") + diags.AddError( + "operation not supported", + "updating a wireless_network is not supported; wireless_networks can only be updated through the dashboard", + ) resp.Diagnostics.Append(diags...) } -func (r *wirelessNetworkResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { +func (r *wirelessNetworkResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { // Retrieve values from state var state wirelessNetworkResourceModel diags := req.State.Get(ctx, &state) - diags.AddError("operation not supported", "deleting a wireless_network is not supported; wireless_networks can only removed from state") + diags.AddError( + "operation not supported", + "deleting a wireless_network is not supported; wireless_networks can only removed from state", + ) resp.Diagnostics.Append(diags...) } -func (r *wirelessNetworkResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { +func (r *wirelessNetworkResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } diff --git a/pkg/config-api-provider/provider/util/retry.go b/pkg/config-api-provider/provider/util/retry.go index 5c73e74d..7d9f03d4 100644 --- a/pkg/config-api-provider/provider/util/retry.go +++ b/pkg/config-api-provider/provider/util/retry.go @@ -23,12 +23,18 @@ func RetryFor429[T any](f func() (T, *http.Response, error)) (T, *http.Response, waitForSeconds := httpResponse.Header.Get("X-Ratelimit-Reset") if waitForSeconds == "" { - return result, httpResponse, errors.Join(err, errors.New("header X-Ratelimit-Reset is missing or contains non valid value")) + return result, httpResponse, errors.Join( + err, + errors.New("header X-Ratelimit-Reset is missing or contains non valid value"), + ) } rateLimitedFor, _ := strconv.Atoi(httpResponse.Header.Get("X-Ratelimit-Reset")) time.Sleep(time.Duration(rateLimitedFor) * time.Second) } - return result, httpResponse, errors.Join(err, errors.New("number of retries exceeded for 429 retries")) + return result, httpResponse, errors.Join( + err, + errors.New("number of retries exceeded for 429 retries"), + ) } diff --git a/pkg/config-api-provider/test/data-sources/agent_test.go b/pkg/config-api-provider/test/data-sources/agent_test.go index aee72f2c..458373b3 100644 --- a/pkg/config-api-provider/test/data-sources/agent_test.go +++ b/pkg/config-api-provider/test/data-sources/agent_test.go @@ -24,7 +24,9 @@ func TestAgentDataSource(t *testing.T) { PreConfig: func() { util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}, + ), 3, ) }, @@ -63,7 +65,9 @@ func TestAgentDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}, + ), 3, ) }, @@ -114,7 +118,9 @@ func TestAgentDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Not found error { diff --git a/pkg/config-api-provider/test/data-sources/group_test.go b/pkg/config-api-provider/test/data-sources/group_test.go index e8ffbef9..cb8ffa0a 100644 --- a/pkg/config-api-provider/test/data-sources/group_test.go +++ b/pkg/config-api-provider/test/data-sources/group_test.go @@ -25,7 +25,11 @@ func TestGroupDataSource(t *testing.T) { PreConfig: func() { util.MockGetGroup( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("uid", "", ""), + }, + ), 3, ) }, @@ -45,12 +49,16 @@ func TestGroupDataSource(t *testing.T) { PreConfig: func() { util.MockGetGroup( "my_root_group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.StructToMap(config_api_client.GroupsGetItem{ - Id: "my_root_group_uid", - Name: "root", - Parent: *config_api_client.NewNullableParent(nil), - Path: "my_root_group_uid", - })}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.StructToMap(config_api_client.GroupsGetItem{ + Id: "my_root_group_uid", + Name: "root", + Parent: *config_api_client.NewNullableParent(nil), + Path: "my_root_group_uid", + }), + }, + ), 1, ) }, @@ -87,7 +95,11 @@ func TestGroupDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetGroup( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("uid", "", ""), + }, + ), 3, ) }, @@ -138,7 +150,9 @@ func TestGroupDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Not found error { diff --git a/pkg/config-api-provider/test/data-sources/network_group_assignment_test.go b/pkg/config-api-provider/test/data-sources/network_group_assignment_test.go index d854e30c..e4bae6a0 100644 --- a/pkg/config-api-provider/test/data-sources/network_group_assignment_test.go +++ b/pkg/config-api-provider/test/data-sources/network_group_assignment_test.go @@ -24,7 +24,11 @@ func TestNetworkGroupAssignmentDataSource(t *testing.T) { PreConfig: func() { util.MockGetNetworkGroupAssignment( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse("uid", ""), + }, + ), 3, ) }, @@ -36,9 +40,21 @@ func TestNetworkGroupAssignmentDataSource(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_network_group_assignment.my_network_group_assignment", "id", "uid"), - resource.TestCheckResourceAttr("data.uxi_network_group_assignment.my_network_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("data.uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid"), + resource.TestCheckResourceAttr( + "data.uxi_network_group_assignment.my_network_group_assignment", + "id", + "uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_network_group_assignment.my_network_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid", + ), ), }, }, @@ -64,7 +80,11 @@ func TestNetworkGroupAssignmentDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetNetworkGroupAssignment( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse("uid", ""), + }, + ), 3, ) }, @@ -76,7 +96,11 @@ func TestNetworkGroupAssignmentDataSource429Handling(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_network_group_assignment.my_network_group_assignment", "id", "uid"), + resource.TestCheckResourceAttr( + "data.uxi_network_group_assignment.my_network_group_assignment", + "id", + "uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -114,7 +138,9 @@ func TestNetworkGroupAssignmentDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, { PreConfig: func() { diff --git a/pkg/config-api-provider/test/data-sources/sensor_group_assignment_test.go b/pkg/config-api-provider/test/data-sources/sensor_group_assignment_test.go index 31e4a84a..530a752b 100644 --- a/pkg/config-api-provider/test/data-sources/sensor_group_assignment_test.go +++ b/pkg/config-api-provider/test/data-sources/sensor_group_assignment_test.go @@ -24,7 +24,11 @@ func TestSensorGroupAssignmentDataSource(t *testing.T) { PreConfig: func() { util.MockGetSensorGroupAssignment( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse("uid", ""), + }, + ), 3, ) }, @@ -36,9 +40,21 @@ func TestSensorGroupAssignmentDataSource(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_sensor_group_assignment.my_sensor_group_assignment", "id", "uid"), - resource.TestCheckResourceAttr("data.uxi_sensor_group_assignment.my_sensor_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("data.uxi_sensor_group_assignment.my_sensor_group_assignment", "sensor_id", "sensor_uid"), + resource.TestCheckResourceAttr( + "data.uxi_sensor_group_assignment.my_sensor_group_assignment", + "id", + "uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_sensor_group_assignment.my_sensor_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_sensor_group_assignment.my_sensor_group_assignment", + "sensor_id", + "sensor_uid", + ), ), }, }, @@ -64,7 +80,11 @@ func TestSensorGroupAssignmentDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetSensorGroupAssignment( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse("uid", ""), + }, + ), 3, ) }, @@ -76,7 +96,11 @@ func TestSensorGroupAssignmentDataSource429Handling(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_sensor_group_assignment.my_sensor_group_assignment", "id", "uid"), + resource.TestCheckResourceAttr( + "data.uxi_sensor_group_assignment.my_sensor_group_assignment", + "id", + "uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -113,7 +137,9 @@ func TestSensorGroupAssignmentDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, { PreConfig: func() { diff --git a/pkg/config-api-provider/test/data-sources/sensor_test.go b/pkg/config-api-provider/test/data-sources/sensor_test.go index 488c58fe..1ffb89ab 100644 --- a/pkg/config-api-provider/test/data-sources/sensor_test.go +++ b/pkg/config-api-provider/test/data-sources/sensor_test.go @@ -24,7 +24,9 @@ func TestSensorDataSource(t *testing.T) { PreConfig: func() { util.MockGetSensor( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateSensorResponseModel("uid", "")}, + ), 3, ) }, @@ -63,7 +65,9 @@ func TestSensorDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetSensor( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateSensorResponseModel("uid", "")}, + ), 3, ) }, @@ -114,7 +118,9 @@ func TestSensorDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Not found error { diff --git a/pkg/config-api-provider/test/data-sources/wired_network_test.go b/pkg/config-api-provider/test/data-sources/wired_network_test.go index 6c141474..0be48206 100644 --- a/pkg/config-api-provider/test/data-sources/wired_network_test.go +++ b/pkg/config-api-provider/test/data-sources/wired_network_test.go @@ -25,7 +25,9 @@ func TestWiredNetworkDataSource(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}, + ), 3, ) }, @@ -37,15 +39,51 @@ func TestWiredNetworkDataSource(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "id", "uid"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "name", "name"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "ip_version", "ip_version"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "security", "security"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "dns_lookup_domain", "dns_lookup_domain"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "disable_edns", "false"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "use_dns64", "false"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "external_connectivity", "false"), - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "vlan_id", "123"), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "id", + "uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "name", + "name", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "ip_version", + "ip_version", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "security", + "security", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "dns_lookup_domain", + "dns_lookup_domain", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "disable_edns", + "false", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "use_dns64", + "false", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "external_connectivity", + "false", + ), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "vlan_id", + "123", + ), ), }, }, @@ -71,7 +109,9 @@ func TestWiredNetworkDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetWiredNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}, + ), 3, ) }, @@ -83,7 +123,11 @@ func TestWiredNetworkDataSource429Handling(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_wired_network.my_wired_network", "id", "uid"), + resource.TestCheckResourceAttr( + "data.uxi_wired_network.my_wired_network", + "id", + "uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -121,7 +165,9 @@ func TestWiredNetworkAssignmentDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, { PreConfig: func() { diff --git a/pkg/config-api-provider/test/data-sources/wireless_network_test.go b/pkg/config-api-provider/test/data-sources/wireless_network_test.go index 9117f0bb..32723160 100644 --- a/pkg/config-api-provider/test/data-sources/wireless_network_test.go +++ b/pkg/config-api-provider/test/data-sources/wireless_network_test.go @@ -25,7 +25,11 @@ func TestWirelessNetworkDataSource(t *testing.T) { PreConfig: func() { util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 3, ) }, @@ -37,17 +41,61 @@ func TestWirelessNetworkDataSource(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "id", "uid"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "ssid", "ssid"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "name", "name"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "ip_version", "ip_version"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "security", "security"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "hidden", "false"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "band_locking", "band_locking"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "dns_lookup_domain", "dns_lookup_domain"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "disable_edns", "false"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "use_dns64", "false"), - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "external_connectivity", "false"), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "id", + "uid", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "ssid", + "ssid", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "name", + "name", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "ip_version", + "ip_version", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "security", + "security", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "hidden", + "false", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "band_locking", + "band_locking", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "dns_lookup_domain", + "dns_lookup_domain", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "disable_edns", + "false", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "use_dns64", + "false", + ), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "external_connectivity", + "false", + ), ), }, }, @@ -73,7 +121,11 @@ func TestWirelessNetworkDataSource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 3, ) }, @@ -85,7 +137,11 @@ func TestWirelessNetworkDataSource429Handling(t *testing.T) { } `, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.uxi_wireless_network.my_wireless_network", "id", "uid"), + resource.TestCheckResourceAttr( + "data.uxi_wireless_network.my_wireless_network", + "id", + "uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -123,7 +179,9 @@ func TestWirelessNetworkAssignmentDataSourceHttpErrorHandling(t *testing.T) { } } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, { PreConfig: func() { diff --git a/pkg/config-api-provider/test/resources/agent_group_assignment_test.go b/pkg/config-api-provider/test/resources/agent_group_assignment_test.go index 8510958e..707b1f39 100644 --- a/pkg/config-api-provider/test/resources/agent_group_assignment_test.go +++ b/pkg/config-api-provider/test/resources/agent_group_assignment_test.go @@ -23,7 +23,9 @@ func TestAgentGroupAssignmentResource(t *testing.T) { // required for agent import util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}, + ), 2, ) @@ -35,12 +37,19 @@ func TestAgentGroupAssignmentResource(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) // required for agent group assignment create - agentGroupAssignmentResponse := util.GenerateAgentGroupAssignmentResponse("agent_group_assignment_uid", "") + agentGroupAssignmentResponse := util.GenerateAgentGroupAssignmentResponse( + "agent_group_assignment_uid", + "", + ) resources.CreateAgentGroupAssignment = func(request resources.AgentGroupAssignmentRequestModel) resources.AgentGroupAssignmentResponseModel { return agentGroupAssignmentResponse } @@ -71,9 +80,21 @@ func TestAgentGroupAssignmentResource(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_agent_group_assignment.my_agent_group_assignment", "agent_id", "agent_uid"), - resource.TestCheckResourceAttr("uxi_agent_group_assignment.my_agent_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("uxi_agent_group_assignment.my_agent_group_assignment", "id", "agent_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_agent_group_assignment.my_agent_group_assignment", + "agent_id", + "agent_uid", + ), + resource.TestCheckResourceAttr( + "uxi_agent_group_assignment.my_agent_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "uxi_agent_group_assignment.my_agent_group_assignment", + "id", + "agent_group_assignment_uid", + ), ), }, // ImportState testing @@ -87,29 +108,47 @@ func TestAgentGroupAssignmentResource(t *testing.T) { PreConfig: func() { util.MockGetAgent( "agent_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("agent_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateAgentResponseModel("agent_uid_2", "_2"), + }, + ), 2, ) util.MockGetAgent( "agent_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("agent_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateAgentResponseModel("agent_uid", ""), + }, + ), 2, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) // required for creating another group util.MockPostGroup( util.GenerateGroupRequestModel("group_uid_2", "_2", "_2"), - util.StructToMap(util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")), + util.StructToMap( + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + ), 1, ) @@ -122,7 +161,10 @@ func TestAgentGroupAssignmentResource(t *testing.T) { } } resources.CreateAgentGroupAssignment = func(request resources.AgentGroupAssignmentRequestModel) resources.AgentGroupAssignmentResponseModel { - return util.GenerateAgentGroupAssignmentResponse("agent_group_assignment_uid_2", "_2") + return util.GenerateAgentGroupAssignmentResponse( + "agent_group_assignment_uid_2", + "_2", + ) } }, Config: provider.ProviderConfig + ` @@ -166,9 +208,21 @@ func TestAgentGroupAssignmentResource(t *testing.T) { group_id = uxi_group.my_group_2.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_agent_group_assignment.my_agent_group_assignment", "agent_id", "agent_uid_2"), - resource.TestCheckResourceAttr("uxi_agent_group_assignment.my_agent_group_assignment", "group_id", "group_uid_2"), - resource.TestCheckResourceAttr("uxi_agent_group_assignment.my_agent_group_assignment", "id", "agent_group_assignment_uid_2"), + resource.TestCheckResourceAttr( + "uxi_agent_group_assignment.my_agent_group_assignment", + "agent_id", + "agent_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_agent_group_assignment.my_agent_group_assignment", + "group_id", + "group_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_agent_group_assignment.my_agent_group_assignment", + "id", + "agent_group_assignment_uid_2", + ), ), }, // Delete testing automatically occurs in TestCase @@ -176,22 +230,38 @@ func TestAgentGroupAssignmentResource(t *testing.T) { PreConfig: func() { util.MockGetAgent( "agent_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("agent_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateAgentResponseModel("agent_uid", ""), + }, + ), 2, ) util.MockGetAgent( "agent_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("agent_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateAgentResponseModel("agent_uid_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockDeleteGroup("group_uid", 1) diff --git a/pkg/config-api-provider/test/resources/agent_test.go b/pkg/config-api-provider/test/resources/agent_test.go index cd34160b..ec6eef64 100644 --- a/pkg/config-api-provider/test/resources/agent_test.go +++ b/pkg/config-api-provider/test/resources/agent_test.go @@ -28,14 +28,18 @@ func TestAgentResource(t *testing.T) { pcap_mode = "light" }`, - ExpectError: regexp.MustCompile(`creating an agent is not supported; agents can only be imported`), + ExpectError: regexp.MustCompile( + `creating an agent is not supported; agents can only be imported`, + ), }, // Importing an agent { PreConfig: func() { util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}, + ), 2, ) }, @@ -63,7 +67,9 @@ func TestAgentResource(t *testing.T) { PreConfig: func() { util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}, + ), 1, ) }, @@ -77,13 +83,17 @@ func TestAgentResource(t *testing.T) { // original util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "")}, + ), 1, ) // updated util.MockGetAgent( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateAgentResponseModel("uid", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateAgentResponseModel("uid", "_2")}, + ), 1, ) }, @@ -193,7 +203,9 @@ func TestAgentResourceHttpErrorHandling(t *testing.T) { id = "uid" }`, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Read not found { diff --git a/pkg/config-api-provider/test/resources/group_test.go b/pkg/config-api-provider/test/resources/group_test.go index f65c89ed..fa2f4261 100644 --- a/pkg/config-api-provider/test/resources/group_test.go +++ b/pkg/config-api-provider/test/resources/group_test.go @@ -44,7 +44,11 @@ func TestGroupResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("uxi_group.my_group", "name", "name"), - resource.TestCheckResourceAttr("uxi_group.my_group", "parent_group_id", "parent_uid"), + resource.TestCheckResourceAttr( + "uxi_group.my_group", + "parent_group_id", + "parent_uid", + ), resource.TestCheckResourceAttr("uxi_group.my_group", "id", "uid"), ), }, @@ -87,7 +91,11 @@ func TestGroupResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("uxi_group.my_group", "name", "name_2"), - resource.TestCheckResourceAttr("uxi_group.my_group", "parent_group_id", "parent_uid"), + resource.TestCheckResourceAttr( + "uxi_group.my_group", + "parent_group_id", + "parent_uid", + ), resource.TestCheckResourceAttr("uxi_group.my_group", "id", "uid"), ), }, @@ -106,7 +114,10 @@ func TestGroupResource(t *testing.T) { 1, ) util.MockGetGroup("new_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("new_uid", "", "_2")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("new_uid", "", "_2"), + }, + ), 1, ) // delete old group (being replaced) @@ -119,7 +130,11 @@ func TestGroupResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("uxi_group.my_group", "name", "name"), - resource.TestCheckResourceAttr("uxi_group.my_group", "parent_group_id", "parent_uid_2"), + resource.TestCheckResourceAttr( + "uxi_group.my_group", + "parent_group_id", + "parent_uid_2", + ), resource.TestCheckResourceAttr("uxi_group.my_group", "id", "new_uid"), ), }, @@ -127,7 +142,10 @@ func TestGroupResource(t *testing.T) { { PreConfig: func() { util.MockGetGroup("new_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("new_uid", "", "_2")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("new_uid", "", "_2"), + }, + ), 1, ) util.MockDeleteGroup("new_uid", 1) @@ -204,7 +222,11 @@ func TestGroupResource429Handling(t *testing.T) { ) util.MockGetGroup( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("uid", "", ""), + }, + ), 1, ) }, @@ -306,7 +328,9 @@ func TestGroupResourceHttpErrorHandling(t *testing.T) { id = "uid" } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Read not found { @@ -349,7 +373,9 @@ func TestGroupResourceHttpErrorHandling(t *testing.T) { name = "name" parent_group_id = "parent_uid" }`, - ExpectError: regexp.MustCompile(`(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Create group in prep for next step { @@ -361,7 +387,11 @@ func TestGroupResourceHttpErrorHandling(t *testing.T) { ) util.MockGetGroup( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("uid", "", ""), + }, + ), 1, ) }, @@ -398,7 +428,9 @@ func TestGroupResourceHttpErrorHandling(t *testing.T) { name = "name_2" parent_group_id = "parent_uid" }`, - ExpectError: regexp.MustCompile(`(?s)Unable to create group - a sibling group already has the specified name\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Unable to create group - a sibling group already has the specified name\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Delete 4xx { @@ -419,8 +451,10 @@ func TestGroupResourceHttpErrorHandling(t *testing.T) { "debugId": "12312-123123-123123-1231212", }) }, - Config: provider.ProviderConfig, - ExpectError: regexp.MustCompile(`(?s)Unable to delete group\s*DebugID: 12312-123123-123123-1231212`), + Config: provider.ProviderConfig, + ExpectError: regexp.MustCompile( + `(?s)Unable to delete group\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Actually delete group for cleanup reasons { diff --git a/pkg/config-api-provider/test/resources/network_group_assignment_test.go b/pkg/config-api-provider/test/resources/network_group_assignment_test.go index 63b294aa..0585a229 100644 --- a/pkg/config-api-provider/test/resources/network_group_assignment_test.go +++ b/pkg/config-api-provider/test/resources/network_group_assignment_test.go @@ -25,7 +25,11 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -36,19 +40,35 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) // required for network group assignment create util.MockPostNetworkGroupAssignment( - util.GenerateNetworkGroupAssignmentRequest("network_group_assignment_uid", ""), - util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", ""), + util.GenerateNetworkGroupAssignmentRequest( + "network_group_assignment_uid", + "", + ), + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -73,9 +93,21 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "id", "network_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "id", + "network_group_assignment_uid", + ), ), }, // ImportState testing @@ -83,7 +115,14 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { PreConfig: func() { util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -96,47 +135,85 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid_2", "_2"), + }, + ), 2, ) util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 3, ) // required for creating another group util.MockPostGroup( util.GenerateGroupRequestModel("group_uid_2", "_2", "_2"), - util.StructToMap(util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")), + util.StructToMap( + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + ), 1, ) // required for network group assignment create util.MockDeleteNetworkGroupAssignment("network_group_assignment_uid", 1) util.MockPostNetworkGroupAssignment( - util.GenerateNetworkGroupAssignmentRequest("network_group_assignment_uid_2", "_2"), - util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid_2", "_2"), + util.GenerateNetworkGroupAssignmentRequest( + "network_group_assignment_uid_2", + "_2", + ), + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid_2", + "_2", + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid_2", + "_2", + ), + }, + ), 2, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 2, ) }, @@ -177,9 +254,21 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { group_id = uxi_group.my_group_2.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid_2"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "group_id", "group_uid_2"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "id", "network_group_assignment_uid_2"), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "group_id", + "group_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "id", + "network_group_assignment_uid_2", + ), ), }, // Delete network-group-assignments and remove networks from state @@ -187,30 +276,58 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid_2", "_2"), + }, + ), 1, ) util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) util.MockGetGroup("group_uid_2", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid_2", + "_2", + ), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -256,7 +373,11 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { // required for network import util.MockGetWirelessNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("network_uid", ""), + }, + ), 2, ) // required for group create @@ -267,19 +388,36 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) // required for network group assignment create util.MockPostNetworkGroupAssignment( - util.GenerateNetworkGroupAssignmentRequest("network_group_assignment_uid", ""), - util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", ""), + util.GenerateNetworkGroupAssignmentRequest( + "network_group_assignment_uid", + "", + ), + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -304,9 +442,21 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "id", "network_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "id", + "network_group_assignment_uid", + ), ), }, // ImportState testing @@ -314,7 +464,14 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { PreConfig: func() { util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -327,12 +484,20 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { PreConfig: func() { util.MockGetWirelessNetwork( "network_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("network_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("network_uid_2", "_2"), + }, + ), 2, ) util.MockGetWirelessNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -340,35 +505,65 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { util.MockDeleteNetworkGroupAssignment("network_group_assignment_uid", 1) util.MockPostGroup( util.GenerateGroupRequestModel("group_uid_2", "_2", "_2"), - util.StructToMap(util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")), + util.StructToMap( + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + ), 1, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 3, ) // required for network group assignment create util.MockGetNetworkGroupAssignment( "network_group_assignment_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid_2", + "_2", + ), + }, + ), 2, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 2, ) util.MockPostNetworkGroupAssignment( - util.GenerateNetworkGroupAssignmentRequest("network_group_assignment_uid_2", "_2"), - util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid_2", "_2"), + util.GenerateNetworkGroupAssignmentRequest( + "network_group_assignment_uid_2", + "_2", + ), + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid_2", + "_2", + ), 1, ) }, @@ -409,9 +604,21 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { group_id = uxi_group.my_group_2.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid_2"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "group_id", "group_uid_2"), - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "id", "network_group_assignment_uid_2"), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "group_id", + "group_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "id", + "network_group_assignment_uid_2", + ), ), }, // Delete network-group-assignments and remove networks from state @@ -419,32 +626,62 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) { PreConfig: func() { util.MockGetWirelessNetwork( "network_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("network_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("network_uid_2", "_2"), + }, + ), 1, ) util.MockGetWirelessNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("network_uid", ""), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid_2", + "_2", + ), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -489,7 +726,11 @@ func TestNetworkGroupAssignmentResource429Handling(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -500,7 +741,10 @@ func TestNetworkGroupAssignmentResource429Handling(t *testing.T) { 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) @@ -510,13 +754,26 @@ func TestNetworkGroupAssignmentResource429Handling(t *testing.T) { Reply(429). SetHeaders(util.RateLimitingHeaders) util.MockPostNetworkGroupAssignment( - util.GenerateNetworkGroupAssignmentRequest("network_group_assignment_uid", ""), - util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", ""), + util.GenerateNetworkGroupAssignmentRequest( + "network_group_assignment_uid", + "", + ), + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -541,7 +798,11 @@ func TestNetworkGroupAssignmentResource429Handling(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid"), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -553,16 +814,30 @@ func TestNetworkGroupAssignmentResource429Handling(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -606,7 +881,11 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -617,7 +896,10 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) @@ -652,14 +934,20 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { network_id = uxi_wired_network.my_network.id group_id = uxi_group.my_group.id }`, - ExpectError: regexp.MustCompile(`(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`, + ), }, // read not found error { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -670,7 +958,10 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) @@ -713,7 +1004,11 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -724,7 +1019,10 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) @@ -765,14 +1063,20 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Actually creating a network group assignment - for next step { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 2, ) @@ -783,19 +1087,35 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) // required for network group assignment create util.MockPostNetworkGroupAssignment( - util.GenerateNetworkGroupAssignmentRequest("network_group_assignment_uid", ""), - util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", ""), + util.GenerateNetworkGroupAssignmentRequest( + "network_group_assignment_uid", + "", + ), + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -820,7 +1140,11 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_network_group_assignment.my_network_group_assignment", "network_id", "network_uid"), + resource.TestCheckResourceAttr( + "uxi_network_group_assignment.my_network_group_assignment", + "network_id", + "network_uid", + ), ), }, // Delete network-group assignment and remove networks from state - errors @@ -828,16 +1152,30 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -861,23 +1199,39 @@ func TestNetworkGroupAssignmentResourceHttpErrorHandling(t *testing.T) { destroy = false } }`, - ExpectError: regexp.MustCompile(`(?s)Forbidden - user has insufficient permissions to complete the request\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Forbidden - user has insufficient permissions to complete the request\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Actually delete network-group assignment and remove networks from state { PreConfig: func() { util.MockGetWiredNetwork( "network_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("network_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWiredNetworkResponse("network_uid", ""), + }, + ), 1, ) util.MockGetGroup("group_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetNetworkGroupAssignment( "network_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateNetworkGroupAssignmentResponse("network_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateNetworkGroupAssignmentResponse( + "network_group_assignment_uid", + "", + ), + }, + ), 1, ) util.MockDeleteGroup("group_uid", 1) diff --git a/pkg/config-api-provider/test/resources/sensor_group_assignment_test.go b/pkg/config-api-provider/test/resources/sensor_group_assignment_test.go index f42f8514..952928c4 100644 --- a/pkg/config-api-provider/test/resources/sensor_group_assignment_test.go +++ b/pkg/config-api-provider/test/resources/sensor_group_assignment_test.go @@ -24,7 +24,10 @@ func TestSensorGroupAssignmentResource(t *testing.T) { PreConfig: func() { // required for sensor import util.MockGetSensor("uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 2, ) @@ -36,19 +39,36 @@ func TestSensorGroupAssignmentResource(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) // required for sensor group assignment create util.MockPostSensorGroupAssignment( - util.GenerateSensorGroupAssignmentRequest("sensor_group_assignment_uid", ""), - util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", ""), + util.GenerateSensorGroupAssignmentRequest( + "sensor_group_assignment_uid", + "", + ), + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -76,9 +96,21 @@ func TestSensorGroupAssignmentResource(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "sensor_id", "sensor_uid"), - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "id", "sensor_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "sensor_id", + "sensor_uid", + ), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "id", + "sensor_group_assignment_uid", + ), ), }, // ImportState testing @@ -86,7 +118,14 @@ func TestSensorGroupAssignmentResource(t *testing.T) { PreConfig: func() { util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -98,22 +137,36 @@ func TestSensorGroupAssignmentResource(t *testing.T) { { PreConfig: func() { util.MockGetSensor("sensor_uid_2", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid_2", "_2")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid_2", "_2"), + }, + ), 2, ) util.MockGetSensor("sensor_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 3, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 2, ) @@ -121,25 +174,47 @@ func TestSensorGroupAssignmentResource(t *testing.T) { util.MockDeleteSensorGroupAssignment("sensor_group_assignment_uid", 1) util.MockPostGroup( util.GenerateGroupRequestModel("group_uid_2", "_2", "_2"), - util.StructToMap(util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")), + util.StructToMap( + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + ), 1, ) // required for sensor group assignment create util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid_2", + "_2", + ), + }, + ), 1, ) util.MockPostSensorGroupAssignment( - util.GenerateSensorGroupAssignmentRequest("sensor_group_assignment_uid_2", "_2"), - util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid_2", "_2"), + util.GenerateSensorGroupAssignmentRequest( + "sensor_group_assignment_uid_2", + "_2", + ), + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid_2", + "_2", + ), 1, ) }, @@ -186,9 +261,21 @@ func TestSensorGroupAssignmentResource(t *testing.T) { group_id = uxi_group.my_group_2.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "sensor_id", "sensor_uid_2"), - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "group_id", "group_uid_2"), - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "id", "sensor_group_assignment_uid_2"), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "sensor_id", + "sensor_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "group_id", + "group_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "id", + "sensor_group_assignment_uid_2", + ), ), }, // Delete sensor-group assignments and remove sensors from state @@ -196,17 +283,32 @@ func TestSensorGroupAssignmentResource(t *testing.T) { PreConfig: func() { util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -250,7 +352,10 @@ func TestSensorGroupAssignmentResource429Handling(t *testing.T) { PreConfig: func() { // required for sensor import util.MockGetSensor("sensor_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 2, ) @@ -262,7 +367,11 @@ func TestSensorGroupAssignmentResource429Handling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -272,13 +381,26 @@ func TestSensorGroupAssignmentResource429Handling(t *testing.T) { Reply(429). SetHeaders(util.RateLimitingHeaders) util.MockPostSensorGroupAssignment( - util.GenerateSensorGroupAssignmentRequest("sensor_group_assignment_uid", ""), - util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", ""), + util.GenerateSensorGroupAssignmentRequest( + "sensor_group_assignment_uid", + "", + ), + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -306,7 +428,11 @@ func TestSensorGroupAssignmentResource429Handling(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "id", "sensor_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "id", + "sensor_group_assignment_uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -318,12 +444,23 @@ func TestSensorGroupAssignmentResource429Handling(t *testing.T) { PreConfig: func() { util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -375,7 +512,10 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { PreConfig: func() { // required for sensor import util.MockGetSensor("sensor_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 1, ) @@ -387,7 +527,11 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -425,14 +569,19 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { sensor_id = uxi_sensor.my_sensor.id group_id = uxi_group.my_group.id }`, - ExpectError: regexp.MustCompile(`(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`, + ), }, // read not found error { PreConfig: func() { // required for sensor import util.MockGetSensor("sensor_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 1, ) @@ -444,7 +593,11 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -490,7 +643,10 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { PreConfig: func() { // required for sensor import util.MockGetSensor("sensor_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 1, ) @@ -502,7 +658,11 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -546,14 +706,19 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { } `, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Actually Creating a sensor group assignment - needed for next step { PreConfig: func() { // required for sensor import util.MockGetSensor("sensor_uid", util.GeneratePaginatedResponse( - []map[string]interface{}{util.GenerateSensorResponseModel("sensor_uid", "")}), + []map[string]interface{}{ + util.GenerateSensorResponseModel("sensor_uid", ""), + }, + ), 2, ) @@ -565,19 +730,36 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) // required for sensor group assignment create util.MockPostSensorGroupAssignment( - util.GenerateSensorGroupAssignmentRequest("sensor_group_assignment_uid", ""), - util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", ""), + util.GenerateSensorGroupAssignmentRequest( + "sensor_group_assignment_uid", + "", + ), + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) }, @@ -605,7 +787,11 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_sensor_group_assignment.my_sensor_group_assignment", "id", "sensor_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_sensor_group_assignment.my_sensor_group_assignment", + "id", + "sensor_group_assignment_uid", + ), ), }, // Delete sensor-group assignments and remove sensors from state - errors @@ -613,12 +799,23 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { PreConfig: func() { util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) @@ -648,19 +845,32 @@ func TestSensorGroupAssignmentResourceHttpErrorHandling(t *testing.T) { destroy = false } }`, - ExpectError: regexp.MustCompile(`(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Actually Delete sensor-group assignments and remove sensors from state { PreConfig: func() { util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetSensorGroupAssignment( "sensor_group_assignment_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateSensorGroupAssignmentResponse("sensor_group_assignment_uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateSensorGroupAssignmentResponse( + "sensor_group_assignment_uid", + "", + ), + }, + ), 1, ) util.MockDeleteGroup("group_uid", 1) diff --git a/pkg/config-api-provider/test/resources/sensor_test.go b/pkg/config-api-provider/test/resources/sensor_test.go index 0cee7715..6c84d0a4 100644 --- a/pkg/config-api-provider/test/resources/sensor_test.go +++ b/pkg/config-api-provider/test/resources/sensor_test.go @@ -34,7 +34,9 @@ func TestSensorResource(t *testing.T) { pcap_mode = "light" }`, - ExpectError: regexp.MustCompile(`creating a sensor is not supported; sensors can only be imported`), + ExpectError: regexp.MustCompile( + `creating a sensor is not supported; sensors can only be imported`, + ), }, // Importing a sensor { @@ -59,7 +61,11 @@ func TestSensorResource(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "name", "name"), - resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "address_note", "address_note"), + resource.TestCheckResourceAttr( + "uxi_sensor.my_sensor", + "address_note", + "address_note", + ), resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "notes", "notes"), resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "pcap_mode", "light"), resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "id", "uid"), @@ -100,7 +106,11 @@ func TestSensorResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "name", "name_2"), - resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "address_note", "address_note_2"), + resource.TestCheckResourceAttr( + "uxi_sensor.my_sensor", + "address_note", + "address_note_2", + ), resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "notes", "notes_2"), resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "pcap_mode", "light_2"), resource.TestCheckResourceAttr("uxi_sensor.my_sensor", "id", "uid"), @@ -114,8 +124,10 @@ func TestSensorResource(t *testing.T) { 1, ) }, - Config: provider.ProviderConfig + ``, - ExpectError: regexp.MustCompile(`deleting a sensor is not supported; sensors can only removed from state`), + Config: provider.ProviderConfig + ``, + ExpectError: regexp.MustCompile( + `deleting a sensor is not supported; sensors can only removed from state`, + ), }, // Remove sensor from state { @@ -233,7 +245,9 @@ func TestSensorResourceHttpErrorHandling(t *testing.T) { id = "uid" }`, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Read not found { diff --git a/pkg/config-api-provider/test/resources/service_test.go b/pkg/config-api-provider/test/resources/service_test.go index 28f286cd..b69e97de 100644 --- a/pkg/config-api-provider/test/resources/service_test.go +++ b/pkg/config-api-provider/test/resources/service_test.go @@ -30,7 +30,9 @@ func TestServiceTestResource(t *testing.T) { name = "name" }`, - ExpectError: regexp.MustCompile(`(?s)creating a service_test is not supported; service_tests can only be\s*imported`), + ExpectError: regexp.MustCompile( + `(?s)creating a service_test is not supported; service_tests can only be\s*imported`, + ), }, // Importing a service_test { @@ -50,7 +52,11 @@ func TestServiceTestResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_service_test.my_service_test", "name", "name"), + resource.TestCheckResourceAttr( + "uxi_service_test.my_service_test", + "name", + "name", + ), resource.TestCheckResourceAttr("uxi_service_test.my_service_test", "id", "uid"), ), }, @@ -66,12 +72,16 @@ func TestServiceTestResource(t *testing.T) { resource "uxi_service_test" "my_service_test" { name = "updated_name" }`, - ExpectError: regexp.MustCompile(`(?s)updating a service_test is not supported; service_tests can only be updated\s*through the dashboard`), + ExpectError: regexp.MustCompile( + `(?s)updating a service_test is not supported; service_tests can only be updated\s*through the dashboard`, + ), }, // Deleting a service_test is not allowed { - Config: provider.ProviderConfig + ``, - ExpectError: regexp.MustCompile(`(?s)deleting a service_test is not supported; service_tests can only removed from\s*state`), + Config: provider.ProviderConfig + ``, + ExpectError: regexp.MustCompile( + `(?s)deleting a service_test is not supported; service_tests can only removed from\s*state`, + ), }, // Remove service_test from state { diff --git a/pkg/config-api-provider/test/resources/service_test_group_assignment_test.go b/pkg/config-api-provider/test/resources/service_test_group_assignment_test.go index 6842770b..4986c7e9 100644 --- a/pkg/config-api-provider/test/resources/service_test_group_assignment_test.go +++ b/pkg/config-api-provider/test/resources/service_test_group_assignment_test.go @@ -38,18 +38,33 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) // required for serviceTest group assignment create util.MockPostServiceTestGroupAssignment( - util.GenerateServiceTestGroupAssignmentRequest("service_test_group_assignment_uid", ""), - util.StructToMap(util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid", "")), + util.GenerateServiceTestGroupAssignmentRequest( + "service_test_group_assignment_uid", + "", + ), + util.StructToMap( + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ), + ), 1, ) resources.GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { - return util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid", "") + return util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ) } }, @@ -73,9 +88,21 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "service_test_id", "service_test_uid"), - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "group_id", "group_uid"), - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "id", "service_test_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "service_test_id", + "service_test_uid", + ), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "group_id", + "group_uid", + ), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "id", + "service_test_group_assignment_uid", + ), ), }, // ImportState testing @@ -96,12 +123,20 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { } util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 3, ) @@ -111,21 +146,34 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { // required for creating another group util.MockPostGroup( util.GenerateGroupRequestModel("group_uid_2", "_2", "_2"), - util.StructToMap(util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")), + util.StructToMap( + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + ), 1, ) // required for serviceTest group assignment create resources.GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { if uid == "service_test_group_assignment_uid" { - return util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid", "") + return util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ) } else { return util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid_2", "_2") } } util.MockPostServiceTestGroupAssignment( - util.GenerateServiceTestGroupAssignmentRequest("service_test_group_assignment_uid_2", "_2"), - util.StructToMap(util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid_2", "_2")), + util.GenerateServiceTestGroupAssignmentRequest( + "service_test_group_assignment_uid_2", + "_2", + ), + util.StructToMap( + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid_2", + "_2", + ), + ), 1, ) }, @@ -166,9 +214,21 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { group_id = uxi_group.my_group_2.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "service_test_id", "service_test_uid_2"), - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "group_id", "group_uid_2"), - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "id", "service_test_group_assignment_uid_2"), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "service_test_id", + "service_test_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "group_id", + "group_uid_2", + ), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "id", + "service_test_group_assignment_uid_2", + ), ), }, // Remove serviceTests from state @@ -176,18 +236,29 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) { PreConfig: func() { util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) util.MockGetGroup( "group_uid_2", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid_2", "_2", "_2")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid_2", "_2", "_2"), + }, + ), 1, ) util.MockDeleteGroup("group_uid", 1) util.MockDeleteGroup("group_uid_2", 1) - util.MockDeleteServiceTestGroupAssignment("service_test_group_assignment_uid_2", 1) + util.MockDeleteServiceTestGroupAssignment( + "service_test_group_assignment_uid_2", + 1, + ) }, Config: provider.ProviderConfig + ` removed { @@ -236,7 +307,11 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -247,12 +322,23 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { SetHeaders(util.RateLimitingHeaders) util.MockPostServiceTestGroupAssignment( - util.GenerateServiceTestGroupAssignmentRequest("service_test_group_assignment_uid", ""), - util.StructToMap(util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid", "")), + util.GenerateServiceTestGroupAssignmentRequest( + "service_test_group_assignment_uid", + "", + ), + util.StructToMap( + util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ), + ), 1, ) resources.GetServiceTestGroupAssignment = func(uid string) config_api_client.ServiceTestGroupAssignmentsPostResponse { - return util.GenerateServiceTestGroupAssignmentResponse("service_test_group_assignment_uid", "") + return util.GenerateServiceTestGroupAssignmentResponse( + "service_test_group_assignment_uid", + "", + ) } }, @@ -276,7 +362,11 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { group_id = uxi_group.my_group.id }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_service_test_group_assignment.my_service_test_group_assignment", "id", "service_test_group_assignment_uid"), + resource.TestCheckResourceAttr( + "uxi_service_test_group_assignment.my_service_test_group_assignment", + "id", + "service_test_group_assignment_uid", + ), func(s *terraform.State) error { st.Assert(t, mock429.Mock.Request().Counter, 0) return nil @@ -288,7 +378,11 @@ func TestServiceTestGroupAssignmentResource429Handling(t *testing.T) { PreConfig: func() { util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -333,7 +427,11 @@ func TestServiceTestGroupAssignmentResourceHttpErrorHandling(t *testing.T) { ) util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) @@ -368,14 +466,20 @@ func TestServiceTestGroupAssignmentResourceHttpErrorHandling(t *testing.T) { service_test_id = uxi_service_test.my_service_test.id group_id = uxi_group.my_group.id }`, - ExpectError: regexp.MustCompile(`(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Validation error - bad request\s*DebugID: 12312-123123-123123-1231212`, + ), }, // Remove serviceTests from state { PreConfig: func() { util.MockGetGroup( "group_uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateGroupResponseModel("group_uid", "", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateGroupResponseModel("group_uid", "", ""), + }, + ), 1, ) diff --git a/pkg/config-api-provider/test/resources/wired_network_test.go b/pkg/config-api-provider/test/resources/wired_network_test.go index 33b0de16..ec0c97ce 100644 --- a/pkg/config-api-provider/test/resources/wired_network_test.go +++ b/pkg/config-api-provider/test/resources/wired_network_test.go @@ -29,14 +29,18 @@ func TestWiredNetworkResource(t *testing.T) { name = "name" }`, - ExpectError: regexp.MustCompile(`(?s)creating a wired_network is not supported; wired_networks can only be\s*imported`), + ExpectError: regexp.MustCompile( + `(?s)creating a wired_network is not supported; wired_networks can only be\s*imported`, + ), }, // Importing a wired_network { PreConfig: func() { util.MockGetWiredNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}, + ), 2, ) }, @@ -51,8 +55,16 @@ func TestWiredNetworkResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_wired_network.my_wired_network", "name", "name"), - resource.TestCheckResourceAttr("uxi_wired_network.my_wired_network", "id", "uid"), + resource.TestCheckResourceAttr( + "uxi_wired_network.my_wired_network", + "name", + "name", + ), + resource.TestCheckResourceAttr( + "uxi_wired_network.my_wired_network", + "id", + "uid", + ), ), }, // ImportState testing @@ -60,7 +72,9 @@ func TestWiredNetworkResource(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}, + ), 1, ) }, @@ -73,7 +87,9 @@ func TestWiredNetworkResource(t *testing.T) { PreConfig: func() { util.MockGetWiredNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}, + ), 1, ) }, @@ -81,19 +97,25 @@ func TestWiredNetworkResource(t *testing.T) { resource "uxi_wired_network" "my_wired_network" { name = "updated_name" }`, - ExpectError: regexp.MustCompile(`(?s)updating a wired_network is not supported; wired_networks can only be updated\s*through the dashboard`), + ExpectError: regexp.MustCompile( + `(?s)updating a wired_network is not supported; wired_networks can only be updated\s*through the dashboard`, + ), }, // Deleting a wired_network is not allowed { PreConfig: func() { util.MockGetWiredNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{util.GenerateWiredNetworkResponse("uid", "")}, + ), 2, ) }, - Config: provider.ProviderConfig + ``, - ExpectError: regexp.MustCompile(`(?s)deleting a wired_network is not supported; wired_networks can only removed\s*from state`), + Config: provider.ProviderConfig + ``, + ExpectError: regexp.MustCompile( + `(?s)deleting a wired_network is not supported; wired_networks can only removed\s*from state`, + ), }, // Remove wired_network from state { @@ -163,7 +185,9 @@ func TestWiredNetworkResourceHttpErrorHandling(t *testing.T) { to = uxi_wired_network.my_wired_network id = "uid" }`, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, }, }) diff --git a/pkg/config-api-provider/test/resources/wireless_network_test.go b/pkg/config-api-provider/test/resources/wireless_network_test.go index 6e725f26..54fdf7f0 100644 --- a/pkg/config-api-provider/test/resources/wireless_network_test.go +++ b/pkg/config-api-provider/test/resources/wireless_network_test.go @@ -29,14 +29,20 @@ func TestWirelessNetworkResource(t *testing.T) { name = "name" }`, - ExpectError: regexp.MustCompile(`(?s)creating a wireless_network is not supported; wireless_networks can only be\s*imported`), + ExpectError: regexp.MustCompile( + `(?s)creating a wireless_network is not supported; wireless_networks can only be\s*imported`, + ), }, // Importing a wireless_network { PreConfig: func() { util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 2, ) }, @@ -51,8 +57,16 @@ func TestWirelessNetworkResource(t *testing.T) { }`, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("uxi_wireless_network.my_wireless_network", "name", "name"), - resource.TestCheckResourceAttr("uxi_wireless_network.my_wireless_network", "id", "uid"), + resource.TestCheckResourceAttr( + "uxi_wireless_network.my_wireless_network", + "name", + "name", + ), + resource.TestCheckResourceAttr( + "uxi_wireless_network.my_wireless_network", + "id", + "uid", + ), ), }, // ImportState testing @@ -60,7 +74,11 @@ func TestWirelessNetworkResource(t *testing.T) { PreConfig: func() { util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 1, ) }, @@ -73,7 +91,11 @@ func TestWirelessNetworkResource(t *testing.T) { PreConfig: func() { util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 1, ) }, @@ -81,26 +103,38 @@ func TestWirelessNetworkResource(t *testing.T) { resource "uxi_wireless_network" "my_wireless_network" { name = "updated_name" }`, - ExpectError: regexp.MustCompile(`(?s)updating a wireless_network is not supported; wireless_networks can only be\s*updated through the dashboard`), + ExpectError: regexp.MustCompile( + `(?s)updating a wireless_network is not supported; wireless_networks can only be\s*updated through the dashboard`, + ), }, // Deleting a wireless_network is not allowed { PreConfig: func() { util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 1, ) }, - Config: provider.ProviderConfig + ``, - ExpectError: regexp.MustCompile(`(?s)deleting a wireless_network is not supported; wireless_networks can only\s*removed from state`), + Config: provider.ProviderConfig + ``, + ExpectError: regexp.MustCompile( + `(?s)deleting a wireless_network is not supported; wireless_networks can only\s*removed from state`, + ), }, // Remove wireless_network from state { PreConfig: func() { util.MockGetWirelessNetwork( "uid", - util.GeneratePaginatedResponse([]map[string]interface{}{util.GenerateWirelessNetworkResponse("uid", "")}), + util.GeneratePaginatedResponse( + []map[string]interface{}{ + util.GenerateWirelessNetworkResponse("uid", ""), + }, + ), 1, ) }, @@ -170,7 +204,9 @@ func TestWirelessNetworkResourceHttpErrorHandling(t *testing.T) { to = uxi_wireless_network.my_wireless_network id = "uid" }`, - ExpectError: regexp.MustCompile(`(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`), + ExpectError: regexp.MustCompile( + `(?s)Current request cannot be processed due to unknown issue\s*DebugID: 12312-123123-123123-1231212`, + ), }, }, }) diff --git a/pkg/config-api-provider/test/util/utils.go b/pkg/config-api-provider/test/util/utils.go index 50a68704..a7880024 100644 --- a/pkg/config-api-provider/test/util/utils.go +++ b/pkg/config-api-provider/test/util/utils.go @@ -52,7 +52,11 @@ func GenerateMockedAgentResponseModel(uid string, postfix string) resources.Agen } } -func GenerateGroupResponseModel(uid string, nonReplacementFieldPostfix string, replacementFieldPostfix string) map[string]interface{} { +func GenerateGroupResponseModel( + uid string, + nonReplacementFieldPostfix string, + replacementFieldPostfix string, +) map[string]interface{} { parentId := "parent_uid" + replacementFieldPostfix return map[string]interface{}{ @@ -64,7 +68,11 @@ func GenerateGroupResponseModel(uid string, nonReplacementFieldPostfix string, r } } -func GenerateGroupRequestModel(uid string, nonReplacementFieldPostfix string, replacementFieldPostfix string) map[string]interface{} { +func GenerateGroupRequestModel( + uid string, + nonReplacementFieldPostfix string, + replacementFieldPostfix string, +) map[string]interface{} { return map[string]interface{}{ "name": "name" + nonReplacementFieldPostfix, "parentId": "parent_uid" + replacementFieldPostfix, @@ -79,7 +87,10 @@ func GeneratePaginatedResponse(items []map[string]interface{}) map[string]interf } } -func GenerateServiceTestResponseModel(uid string, postfix string) resources.ServiceTestResponseModel { +func GenerateServiceTestResponseModel( + uid string, + postfix string, +) resources.ServiceTestResponseModel { return resources.ServiceTestResponseModel{ Uid: uid, Category: "external" + postfix, @@ -142,7 +153,10 @@ func GenerateSensorGroupAssignmentRequest(uid string, postfix string) map[string } } -func GenerateAgentGroupAssignmentResponse(uid string, postfix string) resources.AgentGroupAssignmentResponseModel { +func GenerateAgentGroupAssignmentResponse( + uid string, + postfix string, +) resources.AgentGroupAssignmentResponseModel { return resources.AgentGroupAssignmentResponseModel{ UID: uid, GroupUID: "group_uid" + postfix, @@ -166,7 +180,10 @@ func GenerateNetworkGroupAssignmentRequest(uid string, postfix string) map[strin } } -func GenerateServiceTestGroupAssignmentResponse(uid string, postfix string) config_api_client.ServiceTestGroupAssignmentsPostResponse { +func GenerateServiceTestGroupAssignmentResponse( + uid string, + postfix string, +) config_api_client.ServiceTestGroupAssignmentsPostResponse { return config_api_client.ServiceTestGroupAssignmentsPostResponse{ Id: uid, Group: *config_api_client.NewGroup("group_uid" + postfix), @@ -237,7 +254,12 @@ func MockGetGroup(uid string, response map[string]interface{}, times int) { JSON(response) } -func MockUpdateGroup(uid string, request map[string]interface{}, response map[string]interface{}, times int) { +func MockUpdateGroup( + uid string, + request map[string]interface{}, + response map[string]interface{}, + times int, +) { body, _ := json.Marshal(request) gock.New("https://test.api.capenetworks.com"). Patch("/networking-uxi/v1alpha1/groups/"+uid). @@ -297,7 +319,11 @@ func MockGetSensorGroupAssignment(uid string, response map[string]interface{}, t JSON(response) } -func MockPostSensorGroupAssignment(request map[string]interface{}, response map[string]interface{}, times int) { +func MockPostSensorGroupAssignment( + request map[string]interface{}, + response map[string]interface{}, + times int, +) { gock.New("https://test.api.capenetworks.com"). Post("/networking-uxi/v1alpha1/sensor-group-assignments"). MatchHeader("Content-Type", "application/json"). @@ -326,7 +352,11 @@ func MockGetNetworkGroupAssignment(uid string, response map[string]interface{}, JSON(response) } -func MockPostNetworkGroupAssignment(request map[string]interface{}, response map[string]interface{}, times int) { +func MockPostNetworkGroupAssignment( + request map[string]interface{}, + response map[string]interface{}, + times int, +) { gock.New("https://test.api.capenetworks.com"). Post("/networking-uxi/v1alpha1/network-group-assignments"). MatchHeader("Content-Type", "application/json"). @@ -345,7 +375,11 @@ func MockDeleteNetworkGroupAssignment(uid string, times int) { Reply(204) } -func MockPostServiceTestGroupAssignment(request map[string]interface{}, response map[string]interface{}, times int) { +func MockPostServiceTestGroupAssignment( + request map[string]interface{}, + response map[string]interface{}, + times int, +) { gock.New("https://test.api.capenetworks.com"). Post("/networking-uxi/v1alpha1/service-test-group-assignments"). MatchHeader("Content-Type", "application/json").