Skip to content

Commit

Permalink
breaking(module): migrate from tdabasinskas to datolabs-io (#69)
Browse files Browse the repository at this point in the history
- Migrates repository from the personal space to an organization.
- Will be released as `v3`.
- Files moved to the root of repository, so `/backstage` suffix is no
longer required in the `imports`.
  • Loading branch information
tdabasinskas authored Nov 21, 2024
2 parents b35593e + 7cee082 commit 70c7823
Show file tree
Hide file tree
Showing 52 changed files with 87 additions and 37 deletions.
20 changes: 20 additions & 0 deletions .cspell/custom-dictionary.txt

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

5 changes: 3 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* text=auto eol=lf

go.sum linguist-generated=true
backstage/testdata/ linguist-generated=true
go.sum linguist-generated=true
testdata/* linguist-generated=true
.cspell/custom-dictionary.txt linguist-generated=true
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @tdabasinskas
* @datolabs-io/go-backstage-maintainers
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -15,28 +15,29 @@ 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

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:

```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:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -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": []
}
26 changes: 18 additions & 8 deletions backstage/doc.go → doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/entities/go.mod
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions examples/entities/go.sum

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

3 changes: 2 additions & 1 deletion examples/entities/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions examples/locations/go.mod
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions examples/locations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/tdabasinskas/go-backstage/v2
module github.com/datolabs-io/go-backstage/v3

go 1.23

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion backstage/kind_component.go → kind_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions backstage/kind_location_test.go → kind_location_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

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

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

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

4 changes: 2 additions & 2 deletions backstage/testdata/locations.json → testdata/locations.json

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

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 70c7823

Please sign in to comment.