From e3ec7459ca724fc2ce9ae239c4a2a99132eeea8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:42:34 +0200 Subject: [PATCH 01/12] refactor(structure): move files from backstage subdirectory to root Flatten the package structure by moving all files from the `backstage` subdirectory directly to the root directory. This simplifies the import paths and package organization while maintaining the same functionality. --- backstage/backstage.go => backstage.go | 0 backstage/backstage_test.go => backstage_test.go | 0 backstage/catalog.go => catalog.go | 0 backstage/catalog_test.go => catalog_test.go | 0 backstage/doc.go => doc.go | 0 backstage/entity.go => entity.go | 0 backstage/entity_test.go => entity_test.go | 0 backstage/kind_api.go => kind_api.go | 0 backstage/kind_api_test.go => kind_api_test.go | 0 backstage/kind_component.go => kind_component.go | 0 backstage/kind_component_test.go => kind_component_test.go | 0 backstage/kind_domain.go => kind_domain.go | 0 backstage/kind_domain_test.go => kind_domain_test.go | 0 backstage/kind_group.go => kind_group.go | 0 backstage/kind_group_test.go => kind_group_test.go | 0 backstage/kind_location.go => kind_location.go | 0 backstage/kind_location_test.go => kind_location_test.go | 0 backstage/kind_resource.go => kind_resource.go | 0 backstage/kind_resource_test.go => kind_resource_test.go | 0 backstage/kind_system.go => kind_system.go | 0 backstage/kind_system_test.go => kind_system_test.go | 0 backstage/kind_user.go => kind_user.go | 0 backstage/kind_user_test.go => kind_user_test.go | 0 23 files changed, 0 insertions(+), 0 deletions(-) rename backstage/backstage.go => backstage.go (100%) rename backstage/backstage_test.go => backstage_test.go (100%) rename backstage/catalog.go => catalog.go (100%) rename backstage/catalog_test.go => catalog_test.go (100%) rename backstage/doc.go => doc.go (100%) rename backstage/entity.go => entity.go (100%) rename backstage/entity_test.go => entity_test.go (100%) rename backstage/kind_api.go => kind_api.go (100%) rename backstage/kind_api_test.go => kind_api_test.go (100%) rename backstage/kind_component.go => kind_component.go (100%) rename backstage/kind_component_test.go => kind_component_test.go (100%) rename backstage/kind_domain.go => kind_domain.go (100%) rename backstage/kind_domain_test.go => kind_domain_test.go (100%) rename backstage/kind_group.go => kind_group.go (100%) rename backstage/kind_group_test.go => kind_group_test.go (100%) rename backstage/kind_location.go => kind_location.go (100%) rename backstage/kind_location_test.go => kind_location_test.go (100%) rename backstage/kind_resource.go => kind_resource.go (100%) rename backstage/kind_resource_test.go => kind_resource_test.go (100%) rename backstage/kind_system.go => kind_system.go (100%) rename backstage/kind_system_test.go => kind_system_test.go (100%) rename backstage/kind_user.go => kind_user.go (100%) rename backstage/kind_user_test.go => kind_user_test.go (100%) diff --git a/backstage/backstage.go b/backstage.go similarity index 100% rename from backstage/backstage.go rename to backstage.go diff --git a/backstage/backstage_test.go b/backstage_test.go similarity index 100% rename from backstage/backstage_test.go rename to backstage_test.go diff --git a/backstage/catalog.go b/catalog.go similarity index 100% rename from backstage/catalog.go rename to catalog.go diff --git a/backstage/catalog_test.go b/catalog_test.go similarity index 100% rename from backstage/catalog_test.go rename to catalog_test.go diff --git a/backstage/doc.go b/doc.go similarity index 100% rename from backstage/doc.go rename to doc.go diff --git a/backstage/entity.go b/entity.go similarity index 100% rename from backstage/entity.go rename to entity.go diff --git a/backstage/entity_test.go b/entity_test.go similarity index 100% rename from backstage/entity_test.go rename to entity_test.go diff --git a/backstage/kind_api.go b/kind_api.go similarity index 100% rename from backstage/kind_api.go rename to kind_api.go diff --git a/backstage/kind_api_test.go b/kind_api_test.go similarity index 100% rename from backstage/kind_api_test.go rename to kind_api_test.go diff --git a/backstage/kind_component.go b/kind_component.go similarity index 100% rename from backstage/kind_component.go rename to kind_component.go diff --git a/backstage/kind_component_test.go b/kind_component_test.go similarity index 100% rename from backstage/kind_component_test.go rename to kind_component_test.go diff --git a/backstage/kind_domain.go b/kind_domain.go similarity index 100% rename from backstage/kind_domain.go rename to kind_domain.go diff --git a/backstage/kind_domain_test.go b/kind_domain_test.go similarity index 100% rename from backstage/kind_domain_test.go rename to kind_domain_test.go diff --git a/backstage/kind_group.go b/kind_group.go similarity index 100% rename from backstage/kind_group.go rename to kind_group.go diff --git a/backstage/kind_group_test.go b/kind_group_test.go similarity index 100% rename from backstage/kind_group_test.go rename to kind_group_test.go diff --git a/backstage/kind_location.go b/kind_location.go similarity index 100% rename from backstage/kind_location.go rename to kind_location.go diff --git a/backstage/kind_location_test.go b/kind_location_test.go similarity index 100% rename from backstage/kind_location_test.go rename to kind_location_test.go diff --git a/backstage/kind_resource.go b/kind_resource.go similarity index 100% rename from backstage/kind_resource.go rename to kind_resource.go diff --git a/backstage/kind_resource_test.go b/kind_resource_test.go similarity index 100% rename from backstage/kind_resource_test.go rename to kind_resource_test.go diff --git a/backstage/kind_system.go b/kind_system.go similarity index 100% rename from backstage/kind_system.go rename to kind_system.go diff --git a/backstage/kind_system_test.go b/kind_system_test.go similarity index 100% rename from backstage/kind_system_test.go rename to kind_system_test.go diff --git a/backstage/kind_user.go b/kind_user.go similarity index 100% rename from backstage/kind_user.go rename to kind_user.go diff --git a/backstage/kind_user_test.go b/kind_user_test.go similarity index 100% rename from backstage/kind_user_test.go rename to kind_user_test.go From 412afe90063292c4f47399e80c5091f17c89cea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:42:55 +0200 Subject: [PATCH 02/12] refactor(testdata): move testdata directory out of backstage folder Reorganize project structure by moving the testdata directory to the root level, making it more accessible and following a cleaner directory hierarchy. All JSON and YAML test files remain unchanged, only their location has been updated. --- {backstage/testdata => testdata}/api.json | 0 {backstage/testdata => testdata}/catalog-info.yaml | 0 {backstage/testdata => testdata}/component.json | 0 {backstage/testdata => testdata}/domain.json | 0 {backstage/testdata => testdata}/entities.json | 0 {backstage/testdata => testdata}/entities_fields.json | 0 {backstage/testdata => testdata}/entities_filter.json | 0 {backstage/testdata => testdata}/entities_order.json | 0 {backstage/testdata => testdata}/entities_single.json | 0 {backstage/testdata => testdata}/group.json | 0 {backstage/testdata => testdata}/location.json | 0 {backstage/testdata => testdata}/location_by_id.json | 0 {backstage/testdata => testdata}/location_create.json | 0 {backstage/testdata => testdata}/location_create_dryrun.json | 0 {backstage/testdata => testdata}/locations.json | 0 {backstage/testdata => testdata}/resource.json | 0 {backstage/testdata => testdata}/system.json | 0 {backstage/testdata => testdata}/user.json | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename {backstage/testdata => testdata}/api.json (100%) rename {backstage/testdata => testdata}/catalog-info.yaml (100%) rename {backstage/testdata => testdata}/component.json (100%) rename {backstage/testdata => testdata}/domain.json (100%) rename {backstage/testdata => testdata}/entities.json (100%) rename {backstage/testdata => testdata}/entities_fields.json (100%) rename {backstage/testdata => testdata}/entities_filter.json (100%) rename {backstage/testdata => testdata}/entities_order.json (100%) rename {backstage/testdata => testdata}/entities_single.json (100%) rename {backstage/testdata => testdata}/group.json (100%) rename {backstage/testdata => testdata}/location.json (100%) rename {backstage/testdata => testdata}/location_by_id.json (100%) rename {backstage/testdata => testdata}/location_create.json (100%) rename {backstage/testdata => testdata}/location_create_dryrun.json (100%) rename {backstage/testdata => testdata}/locations.json (100%) rename {backstage/testdata => testdata}/resource.json (100%) rename {backstage/testdata => testdata}/system.json (100%) rename {backstage/testdata => testdata}/user.json (100%) diff --git a/backstage/testdata/api.json b/testdata/api.json similarity index 100% rename from backstage/testdata/api.json rename to testdata/api.json diff --git a/backstage/testdata/catalog-info.yaml b/testdata/catalog-info.yaml similarity index 100% rename from backstage/testdata/catalog-info.yaml rename to testdata/catalog-info.yaml diff --git a/backstage/testdata/component.json b/testdata/component.json similarity index 100% rename from backstage/testdata/component.json rename to testdata/component.json diff --git a/backstage/testdata/domain.json b/testdata/domain.json similarity index 100% rename from backstage/testdata/domain.json rename to testdata/domain.json diff --git a/backstage/testdata/entities.json b/testdata/entities.json similarity index 100% rename from backstage/testdata/entities.json rename to testdata/entities.json diff --git a/backstage/testdata/entities_fields.json b/testdata/entities_fields.json similarity index 100% rename from backstage/testdata/entities_fields.json rename to testdata/entities_fields.json diff --git a/backstage/testdata/entities_filter.json b/testdata/entities_filter.json similarity index 100% rename from backstage/testdata/entities_filter.json rename to testdata/entities_filter.json diff --git a/backstage/testdata/entities_order.json b/testdata/entities_order.json similarity index 100% rename from backstage/testdata/entities_order.json rename to testdata/entities_order.json diff --git a/backstage/testdata/entities_single.json b/testdata/entities_single.json similarity index 100% rename from backstage/testdata/entities_single.json rename to testdata/entities_single.json diff --git a/backstage/testdata/group.json b/testdata/group.json similarity index 100% rename from backstage/testdata/group.json rename to testdata/group.json diff --git a/backstage/testdata/location.json b/testdata/location.json similarity index 100% rename from backstage/testdata/location.json rename to testdata/location.json diff --git a/backstage/testdata/location_by_id.json b/testdata/location_by_id.json similarity index 100% rename from backstage/testdata/location_by_id.json rename to testdata/location_by_id.json diff --git a/backstage/testdata/location_create.json b/testdata/location_create.json similarity index 100% rename from backstage/testdata/location_create.json rename to testdata/location_create.json diff --git a/backstage/testdata/location_create_dryrun.json b/testdata/location_create_dryrun.json similarity index 100% rename from backstage/testdata/location_create_dryrun.json rename to testdata/location_create_dryrun.json diff --git a/backstage/testdata/locations.json b/testdata/locations.json similarity index 100% rename from backstage/testdata/locations.json rename to testdata/locations.json diff --git a/backstage/testdata/resource.json b/testdata/resource.json similarity index 100% rename from backstage/testdata/resource.json rename to testdata/resource.json diff --git a/backstage/testdata/system.json b/testdata/system.json similarity index 100% rename from backstage/testdata/system.json rename to testdata/system.json diff --git a/backstage/testdata/user.json b/testdata/user.json similarity index 100% rename from backstage/testdata/user.json rename to testdata/user.json From 38ad3e5ad1c665810b3d2d8eb82eb86ed1fa34b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:44:48 +0200 Subject: [PATCH 03/12] feat(spelling): add cspell configuration and custom dictionary Added configuration for cSpell to enforce consistent spelling across the codebase. This includes: - New custom dictionary file with project-specific terms - Base cspell.json configuration file with dictionary references --- .cspell/custom-dictionary.txt | 7 +++++++ cspell.json | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .cspell/custom-dictionary.txt create mode 100644 cspell.json diff --git a/.cspell/custom-dictionary.txt b/.cspell/custom-dictionary.txt new file mode 100644 index 0000000..598e501 --- /dev/null +++ b/.cspell/custom-dictionary.txt @@ -0,0 +1,7 @@ +datolabs +stretchr +gock +davecgh +pmezard +parth +difflib diff --git a/cspell.json b/cspell.json new file mode 100644 index 0000000..c93be37 --- /dev/null +++ b/cspell.json @@ -0,0 +1,17 @@ +{ + "version": "0.2", + "ignorePaths": [], + "dictionaryDefinitions": [ + { + "name": "custom-dictionary", + "path": "./.cspell/custom-dictionary.txt", + "addWords": true + } + ], + "dictionaries": [ + "custom-dictionary" + ], + "words": [], + "ignoreWords": [], + "import": [] +} From fe1bf8db0a17002194641dd9acfc3a08a1d0d6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:50:45 +0200 Subject: [PATCH 04/12] chore(repo): update CODEOWNERS to use team ownership Changed ownership from individual user to the dedicated Go Backstage maintainers team for better collaboration and maintenance scalability --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index a3d1cfd..9a38400 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @tdabasinskas +* @datolabs-io/go-backstage-maintainers From 8c199d913dd08860d67f4456d299ebfc2c599b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:51:54 +0200 Subject: [PATCH 05/12] docs(readme): update repository references to datolabs-io Update all repository references in README.md from `tdabasinskas` to `datolabs-io` organization. Also update version references from v2 to v3 to reflect the new major version. BREAKING CHANGE: Repository moved to datolabs-io organization with a new major version v3 --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bdf340e..e1b7a74 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # go-backstage -[![CI](https://github.com/tdabasinskas/go-backstage/actions/workflows/ci.yml/badge.svg)](https://github.com/tdabasinskas/go-backstage/actions/workflows/ci.yml) -[![codecov](https://codecov.io/gh/tdabasinskas/go-backstage/branch/main/graph/badge.svg?token=4CVNSX7UOZ)](https://codecov.io/gh/tdabasinskas/go-backstage) -[![Go Reference](https://pkg.go.dev/badge/github.com/tdabasinskas/go-backstage/backstage.svg)](https://pkg.go.dev/github.com/tdabasinskas/go-backstage/backstage) +[![CI](https://github.com/datolabs-io/go-backstage/actions/workflows/ci.yml/badge.svg)](https://github.com/datolabs-io/go-backstage/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/datolabs-io/go-backstage/branch/main/graph/badge.svg?token=4CVNSX7UOZ)](https://codecov.io/gh/datolabs-io/go-backstage) +[![Go Reference](https://pkg.go.dev/badge/github.com/datolabs-io/go-backstage/backstage.svg)](https://pkg.go.dev/github.com/datolabs-io/go-backstage/backstage) **go-backstage** is a Go client library for accessing the [Backstage REST API](https://backstage.io/docs/features/software-catalog/software-catalog-api). @@ -15,13 +15,13 @@ the low-level details of making HTTP requests and parsing responses, allowing de With Go installed, run the following to add the package to your project, along with its dependencies: ```bash -go get github.com/tdabasinskas/go-backstage/v2 +go get github.com/datolabs-io/go-backstage/v3 ``` Alternatively, you can add import the package as following and run `go get` to install it: ```go -import "github.com/tdabasinskas/go-backstage/v2" +import "github.com/datolabs-io/go-backstage/v3" ``` ## Usage @@ -29,7 +29,7 @@ import "github.com/tdabasinskas/go-backstage/v2" Add the package to your project as following: ```go -import "github.com/tdabasinskas/go-backstage/v2" +import "github.com/datolabs-io/go-backstage/v3" ``` Once imported, create a new Backstage API client to access different parts of Backstage API: From 78168e7760603e4ae514bf6f922373c140b1550e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:57:57 +0200 Subject: [PATCH 06/12] feat(deps): migrate to datolabs-io/go-backstage/v3 Update repository and module paths from tdabasinskas/go-backstage/v2 to datolabs-io/go-backstage/v3. This change includes: - Updating Go version from 1.22 to 1.23 - Upgrading testify dependency to v1.9.0 - Updating import paths in example code - Updating example location target URL BREAKING CHANGE: Module path has changed from github.com/tdabasinskas/go-backstage/v2 to github.com/datolabs-io/go-backstage/v3 --- examples/entities/go.mod | 6 +++--- examples/entities/go.sum | 4 ++-- examples/entities/main.go | 3 ++- examples/locations/go.mod | 6 +++--- examples/locations/main.go | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/entities/go.mod b/examples/entities/go.mod index 4f7fb43..101ac07 100644 --- a/examples/entities/go.mod +++ b/examples/entities/go.mod @@ -1,7 +1,7 @@ module exampleentities -go 1.22 +go 1.23 -replace github.com/tdabasinskas/go-backstage/v2 => ../.. +replace github.com/datolabs-io/go-backstage/v3 => ../.. -require github.com/tdabasinskas/go-backstage/v2 v2.0.0-preview.2 +require github.com/datolabs-io/go-backstage/v3 v3.0.0-00010101000000-000000000000 diff --git a/examples/entities/go.sum b/examples/entities/go.sum index cb54f3d..36c46fd 100644 --- a/examples/entities/go.sum +++ b/examples/entities/go.sum @@ -6,7 +6,7 @@ github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslC github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/examples/entities/main.go b/examples/entities/main.go index a216926..3ed370d 100644 --- a/examples/entities/main.go +++ b/examples/entities/main.go @@ -2,9 +2,10 @@ package main import ( "context" - "github.com/tdabasinskas/go-backstage/v2/backstage" "log" "os" + + "github.com/datolabs-io/go-backstage/v3" ) func main() { diff --git a/examples/locations/go.mod b/examples/locations/go.mod index 32f341c..1659012 100644 --- a/examples/locations/go.mod +++ b/examples/locations/go.mod @@ -1,7 +1,7 @@ module examplelocations -go 1.22 +go 1.23 -replace github.com/tdabasinskas/go-backstage/v2 => ../.. +replace github.com/datolabs-io/go-backstage/v3 => ../.. -require github.com/tdabasinskas/go-backstage/v2 v2.0.0-preview.2 +require github.com/datolabs-io/go-backstage/v3 v3.0.0-00010101000000-000000000000 diff --git a/examples/locations/main.go b/examples/locations/main.go index 7bc421f..eb147fb 100644 --- a/examples/locations/main.go +++ b/examples/locations/main.go @@ -6,11 +6,11 @@ import ( "net/http" "os" - "github.com/tdabasinskas/go-backstage/v2/backstage" + "github.com/datolabs-io/go-backstage/v3" ) func main() { - const locationTarget = "https://github.com/tdabasinskas/go-backstage/tree/main/backstage/testdata" + const locationTarget = "https://github.com/datolabs-io/go-backstage/tree/main/backstage/testdata" baseURL, ok := os.LookupEnv("BACKSTAGE_BASE_URL") if !ok { From 73ff483f7b6c9529eb98daa337e75206671131b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 09:58:13 +0200 Subject: [PATCH 07/12] chore(deps): update module path and add dictionary entries Updated the module path from `github.com/tdabasinskas/go-backstage/v2` to `github.com/datolabs-io/go-backstage/v3` to reflect the new organization ownership. Added new entries to the custom dictionary: - gopkg - exampleentities - examplelocations --- .cspell/custom-dictionary.txt | 12 ++++++++++++ go.mod | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.cspell/custom-dictionary.txt b/.cspell/custom-dictionary.txt index 598e501..b357a75 100644 --- a/.cspell/custom-dictionary.txt +++ b/.cspell/custom-dictionary.txt @@ -5,3 +5,15 @@ davecgh pmezard parth difflib +gopkg +exampleentities +examplelocations +gomod +dryrun +dylib +testdata +Exampler +tiernan +covermode +coverprofile +roadiehq diff --git a/go.mod b/go.mod index 42ae7be..75f311a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/tdabasinskas/go-backstage/v2 +module github.com/datolabs-io/go-backstage/v3 go 1.23 From fe5969e0f05fc9d8247d551f73887a8edc11d32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 10:00:04 +0200 Subject: [PATCH 08/12] fix(component): correct typo in `consumesApis` yaml tag Fixed a typo in the yaml tag for `ConsumesApis` field where it was missing the leading `c` character (`onsumesApis` -> `consumesApis`) --- kind_component.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kind_component.go b/kind_component.go index f30b407..759c862 100644 --- a/kind_component.go +++ b/kind_component.go @@ -42,7 +42,7 @@ type ComponentEntityV1alpha1Spec struct { ProvidesApis []string `json:"providesApis,omitempty" yaml:"providesApis,omitempty"` // ConsumesApis is an array of entity references to the APIs that are consumed by the component. - ConsumesApis []string `json:"consumesApis,omitempty" yaml:"onsumesApis,omitempty"` + ConsumesApis []string `json:"consumesApis,omitempty" yaml:"consumesApis,omitempty"` // DependsOn is an array of entity references to the components and resources that the component depends on. DependsOn []string `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"` From 39d2919aa29e1858bb47ba721b6f2004d9a080d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 10:02:35 +0200 Subject: [PATCH 09/12] chore(git): update path in gitattributes for testdata Changed the testdata path from `backstage/testdata/` to `testdata/` to reflect the correct directory structure for linguist-generated files --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 840baeb..200807c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ * text=auto eol=lf go.sum linguist-generated=true -backstage/testdata/ linguist-generated=true +testdata/ linguist-generated=true From eb233317f1cb06a24deaa51445786f414cdf8c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 10:04:04 +0200 Subject: [PATCH 10/12] docs(readme): update code examples and formatting Add code block syntax highlighting and fix import path in documentation. Improve readability by using proper markdown code blocks with language hints and consistent spacing throughout the documentation. --- README.md | 1 + doc.go | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e1b7a74..95ceed1 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Once imported, create a new Backstage API client to access different parts of Ba ```go client, err := backstage.NewClient(baseURL, "default", nil) ``` + If you want to use a custom HTTP client (for example, to handle authentication, retries or different timeouts), you can pass it as the third argument: diff --git a/doc.go b/doc.go index d01421f..38bd259 100644 --- a/doc.go +++ b/doc.go @@ -5,25 +5,35 @@ Package backstage provides a client for the Backstage API. Add the package to your project as following: - import "github.com/tdabasinskas/go-backstage" +```go +import "github.com/datolabs-io/go-backstage/v3" +``` Once imported, create a new Backstage API client to access different parts of Backstage API: - client, err := backstage.NewClient(baseURL, "default", nil) +```go +client, err := backstage.NewClient(baseURL, "default", nil) +``` If you want to use a custom HTTP client (for example, to handle authentication, retries or different timeouts), you can pass it as the third argument: - httpClient := &http.Client{} - client, err := backstage.NewClient(baseURL, "default", httpClient) +```go +httpClient := &http.Client{} +client, err := backstage.NewClient(baseURL, "default", httpClient) +``` The client than can be used to access different parts of the API, e.g. get the list of entities, sorted in specific order: +```go + entities, response, err := c.Catalog.Entities.s.List(context.Background(), &ListEntityOptions{ - Filters: ListEntityFilter{}, - Fields: []string{}, - Order: []ListEntityOrder{{ Direction: OrderDescending, Field: "metadata.name" }, - }, + Filters: []string{}, + Fields: []string{}, + Order: []ListEntityOrder{{ Direction: OrderDescending, Field: "metadata.name" }, + }, }) + +``` */ package backstage From 640fa0640d52c2ec4119248f2dd4c4bd24a1241d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 10:06:42 +0200 Subject: [PATCH 11/12] refactor(test): update github repository URLs in test data Changed repository URLs from `tdabasinskas/go` to `datolabs-io/go-backstage` across test files to reflect the new repository location --- kind_location_test.go | 4 ++-- testdata/location_by_id.json | 2 +- testdata/location_create.json | 2 +- testdata/location_create_dryrun.json | 2 +- testdata/locations.json | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kind_location_test.go b/kind_location_test.go index 80a6afc..8565389 100644 --- a/kind_location_test.go +++ b/kind_location_test.go @@ -48,7 +48,7 @@ func TestKindLocationGet(t *testing.T) { // TestKindLocationCreateByID tests functionality of creating a new location. func TestKindLocationCreateByID(t *testing.T) { const dataFile = "testdata/location_create.json" - const target = "https://github.com/tdabasinskas/go/backstage/test" + const target = "https://github.com/datolabs-io/go-backstage/test" expected := LocationCreateResponse{} expectedData, _ := os.ReadFile(dataFile) @@ -88,7 +88,7 @@ func TestKindLocationCreateByID(t *testing.T) { // TestKindLocationCreateByID_DryRun tests functionality of creating a new location. func TestKindLocationCreateByID_DryRun(t *testing.T) { const dataFile = "testdata/location_create_dryrun.json" - const target = "https://github.com/tdabasinskas/go/backstage/test" + const target = "https://github.com/datolabs-io/go-backstage/test" expected := LocationCreateResponse{} expectedData, _ := os.ReadFile(dataFile) diff --git a/testdata/location_by_id.json b/testdata/location_by_id.json index 23312e8..6ddfb4d 100644 --- a/testdata/location_by_id.json +++ b/testdata/location_by_id.json @@ -1,5 +1,5 @@ { "id": "830d2354-8bbb-42d1-a751-2959f6da5416", "type": "url", - "target": "https://github.com/tdabasinskas/go/backstage/test" + "target": "https://github.com/datolabs-io/go-backstage/test" } diff --git a/testdata/location_create.json b/testdata/location_create.json index 2196798..4da3beb 100644 --- a/testdata/location_create.json +++ b/testdata/location_create.json @@ -2,7 +2,7 @@ "location": { "id": "830d2354-8bbb-42d1-a751-2959f6da5416", "type": "url", - "target": "https://github.com/tdabasinskas/go/backstage/test" + "target": "https://github.com/datolabs-io/go-backstage/test" }, "entities": [] } diff --git a/testdata/location_create_dryrun.json b/testdata/location_create_dryrun.json index 947f4f1..3cb0ea7 100644 --- a/testdata/location_create_dryrun.json +++ b/testdata/location_create_dryrun.json @@ -3,7 +3,7 @@ "location": { "id": "830d2354-8bbb-42d1-a751-2959f6da5416", "type": "url", - "target": "https://github.com/tdabasinskas/go/backstage/test" + "target": "https://github.com/datolabs-io/go-backstage/test" }, "entities": [] } diff --git a/testdata/locations.json b/testdata/locations.json index 3f6bb19..e9a648c 100644 --- a/testdata/locations.json +++ b/testdata/locations.json @@ -2,14 +2,14 @@ { "data": { "id": "650a7ec5-9813-4f42-ae8a-cde84653daf4", - "target": "https://github.com/tdabasinskas/test", + "target": "https://github.com/datolabs-io/go-backstage/test", "type": "url" } }, { "data": { "id": "ab31518c-91a4-49b8-a65a-3a12c7f92055", - "target": "https://github.com/tdabasinskas/example", + "target": "https://github.com/datolabs-io/go-backstage/example", "type": "url" } } From 7cee08222ad06356c07b6cc453d70656d240e8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Daba=C5=A1inskas?= Date: Thu, 21 Nov 2024 10:09:26 +0200 Subject: [PATCH 12/12] chore(config): update git and spelling configurations Add `testdata` to custom dictionary and mark `.cspell/` directory as linguist-generated to improve repository language statistics accuracy --- .cspell/custom-dictionary.txt | 1 + .gitattributes | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.cspell/custom-dictionary.txt b/.cspell/custom-dictionary.txt index b357a75..d5847bd 100644 --- a/.cspell/custom-dictionary.txt +++ b/.cspell/custom-dictionary.txt @@ -17,3 +17,4 @@ tiernan covermode coverprofile roadiehq +testdata diff --git a/.gitattributes b/.gitattributes index 200807c..d29d0b0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ * text=auto eol=lf -go.sum linguist-generated=true -testdata/ linguist-generated=true +go.sum linguist-generated=true +testdata/* linguist-generated=true +.cspell/custom-dictionary.txt linguist-generated=true