backend,proto: remove
@@ -5,8 +5,6 @@ on:
|
||||
paths:
|
||||
- '*'
|
||||
- '.github/workflows/frontend.yml'
|
||||
- '!backend/inventory/**'
|
||||
- '!backend/scaffolder/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
name: Inventory CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'backend/inventory/**'
|
||||
- '.github/workflows/inventory.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.12
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v1
|
||||
- name: setup env
|
||||
run: |
|
||||
echo "::set-env name=GOPATH::$(go env GOPATH)"
|
||||
echo "::add-path::$(go env GOPATH)/bin"
|
||||
shell: bash
|
||||
- name: build
|
||||
run: go build -v ./...
|
||||
working-directory: ./backend/inventory
|
||||
- name: test
|
||||
run: go test ./... -short
|
||||
working-directory: ./backend/inventory
|
||||
@@ -1,29 +0,0 @@
|
||||
name: Scaffolder CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'backend/scaffolder/**'
|
||||
- '.github/workflows/scaffolder.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.12
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v1
|
||||
- name: setup env
|
||||
run: |
|
||||
echo "::set-env name=GOPATH::$(go env GOPATH)"
|
||||
echo "::add-path::$(go env GOPATH)/bin"
|
||||
shell: bash
|
||||
- name: build
|
||||
run: go build -v ./...
|
||||
working-directory: ./backend/scaffolder
|
||||
- name: test
|
||||
run: go test ./... -short
|
||||
working-directory: ./backend/scaffolder
|
||||
@@ -17,13 +17,13 @@ At Spotify we [strongly believe](https://backstage.io/the-spotify-story) that a
|
||||
|
||||
The Backstage platform consists of a number of different components:
|
||||
|
||||
- **frontend** - Main web application that users interact with. It's built up by a number of different _Plugins_.
|
||||
- **frontend** - Main web application that users interact with. It's built up by a number of different _Plugins_.
|
||||
- **plugins** - Each plugin is treated as a self-contained web app and can include almost any type of content. Plugins all use a common set of platform API's and reusable UI components. Plugins can fetch data either from the _backend_ or through any RESTful API exposed through the _proxy_.
|
||||
- **backend** * - GraphQL aggregation service that holds the model of your software ecosystem, including organisational information and what team owns what software. The backend also has a Plugin model for extending its graph.
|
||||
- **proxy** - Terminates HTTPS and exposes any RESTful API to Plugins.
|
||||
- **identity** * - A backend service that holds your organisation's metadata.
|
||||
- **backend** \* - GraphQL aggregation service that holds the model of your software ecosystem, including organisational information and what team owns what software. The backend also has a Plugin model for extending its graph.
|
||||
- **proxy** \* - Terminates HTTPS and exposes any RESTful API to Plugins.
|
||||
- **identity** \* - A backend service that holds your organisation's metadata.
|
||||
|
||||
_* not yet released_
|
||||
_\* not yet released_
|
||||
|
||||

|
||||
|
||||
@@ -63,20 +63,6 @@ This will prompt you to enter an ID for your plugin, and then create your plugin
|
||||
|
||||
If you have `yarn start` already running you should be able to see the default page for your new plugin at [localhost:3000/my-plugin](http://localhost:3000/my-plugin), if you called the plugin `"my-plugin"`.
|
||||
|
||||
## Running the backend(s) locally
|
||||
|
||||
For running the backend, depending on your OS, you need [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/), [Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/install/), or for Linux, [docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/#install-compose-on-linux-systems).
|
||||
|
||||
The full local system consists of a collection of backend services, as well as a web application. From the root of the project directory, run the following in a terminal to start up all backend services locally:
|
||||
|
||||
```bash
|
||||
$ cd backend
|
||||
|
||||
$ docker-compose up --build
|
||||
```
|
||||
|
||||
To develop backend services, there are some more tools to install, see [backend/README.md](backend/README.md). To update protobuf definitions, you will need another set of tools, see [proto/README.md](proto/README.md).
|
||||
|
||||
## Documentation
|
||||
|
||||
_TODO: Add links to docs on backstage.io_
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
COMPOSE_PROJECT_NAME=backstage
|
||||
@@ -1,38 +0,0 @@
|
||||
ARG base_image=debian:buster
|
||||
|
||||
### Scaffolder Stage
|
||||
### needs extra cookiecutter
|
||||
FROM debian:buster AS scaffolder
|
||||
RUN apt-get update && apt-get install -y python-pip
|
||||
RUN apt-get install -y python-backports.functools-lru-cache
|
||||
RUN pip install cookiecutter==1.7.0 --index-url https://pypi.python.org/simple
|
||||
|
||||
|
||||
### Builder Stage
|
||||
FROM golang:1.13 AS build
|
||||
ARG service
|
||||
|
||||
WORKDIR /build/$service/
|
||||
|
||||
COPY proto/go.mod proto/go.sum /build/proto/
|
||||
COPY $service/go.mod $service/go.sum /build/$service/
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY proto/ /build/proto/
|
||||
COPY $service/ /build/$service/
|
||||
|
||||
RUN go build .
|
||||
|
||||
|
||||
### Running Container Stage
|
||||
FROM ${base_image}
|
||||
ARG service
|
||||
|
||||
RUN apt-get update && apt-get install -y ca-certificates
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
COPY --from=build /build/$service/$service /app/service
|
||||
|
||||
CMD ["./service"]
|
||||
@@ -1,15 +0,0 @@
|
||||
# Backstage Backends
|
||||
|
||||
## Installing Dependencies
|
||||
|
||||
### Go
|
||||
|
||||
To build and run the backend services directly, you need to have Go installed, installation instructions can be found [here](https://golang.org/doc/install#install).
|
||||
|
||||
## Usage
|
||||
|
||||
To run any backend service, go into its directory and run:
|
||||
|
||||
```bash
|
||||
go run .
|
||||
```
|
||||
@@ -1,96 +0,0 @@
|
||||
package ghactions
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
client *http.Client
|
||||
baseURL string
|
||||
accessToken string
|
||||
}
|
||||
|
||||
func NewFromEnv() (*Client, error) {
|
||||
accessToken := os.Getenv("BOSS_GH_ACCESS_TOKEN")
|
||||
|
||||
if accessToken == "" {
|
||||
return nil, fmt.Errorf("BOSS_GH_ACCESS_TOKEN not set")
|
||||
}
|
||||
|
||||
return New(http.DefaultClient, "https://api.github.com", accessToken), nil
|
||||
}
|
||||
|
||||
func New(client *http.Client, baseURL, accessToken string) *Client {
|
||||
return &Client{
|
||||
client: client,
|
||||
baseURL: baseURL,
|
||||
accessToken: accessToken,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) createRequest(ctx context.Context, owner, repo, path string) (*http.Request, error) {
|
||||
url := fmt.Sprintf("%s/repos/%s/%s/actions%s", c.baseURL, owner, repo, path)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req.Header.Add("Authorization", "Bearer "+c.accessToken)
|
||||
|
||||
return req.WithContext(ctx), nil
|
||||
}
|
||||
|
||||
func (c *Client) ListWorkflowRuns(ctx context.Context, owner, repo string) (*WorkflowRunsListResponse, error) {
|
||||
req, err := c.createRequest(ctx, owner, repo, "/runs")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
if res.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("Upstream fetch failed with status %d %s", res.StatusCode, res.Status)
|
||||
}
|
||||
|
||||
var resData WorkflowRunsListResponse
|
||||
if err := json.NewDecoder(res.Body).Decode(&resData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &resData, nil
|
||||
}
|
||||
|
||||
func (c *Client) GetWorkflowRun(ctx context.Context, owner, repo, runId string) (*WorkflowRunResponse, error) {
|
||||
req, err := c.createRequest(ctx, owner, repo, fmt.Sprintf("/runs/%s", runId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := c.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
if res.StatusCode != http.StatusOK {
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Upstream fetch failed with status %d %s", res.StatusCode, res.Status)
|
||||
}
|
||||
|
||||
var resData WorkflowRunResponse
|
||||
if err := json.NewDecoder(res.Body).Decode(&resData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &resData, nil
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package ghactions
|
||||
|
||||
type User struct {
|
||||
Name string `json:"name"` // "Octo Cat"
|
||||
Email string `json:"email"` // "octocat@github.com"
|
||||
}
|
||||
|
||||
type Commit struct {
|
||||
ID string `json:"id"` // "acb5820ced9479c074f688cc328bf03f341a511d"
|
||||
TreeID string `json:"tree_id"` // "d23f6eedb1e1b9610bbc754ddb5197bfe7271223"
|
||||
Message string `json:"message"` // "Create linter.yml"
|
||||
Timestamp string `json:"timestamp"` // "2020-01-22T19:33:05Z"
|
||||
Author User `json:"author"`
|
||||
Committer User `json:"committer"`
|
||||
}
|
||||
|
||||
type Repository struct {
|
||||
ID int64 `json:"id"` // 217723378
|
||||
NodeID string `json:"node_id"` // MDEwOlJlcG9zaXRvcnkyMTc3MjMzNzg="
|
||||
Name string `json:"name"` // o-repo"
|
||||
FullName string `json:"full_name"` // "octo-org/octo-repo"
|
||||
HTMLURL string `json:"html_url"` // "https://github.com/octo-org/octo-repo"
|
||||
}
|
||||
|
||||
type WorkflowRunResponse struct {
|
||||
ID int64 `json:"id"` // 30433642
|
||||
NodeID string `json:"node_id"` // "MDEyOldvcmtmbG93IFJ1bjI2OTI4OQ=="
|
||||
HeadBranch string `json:"head_branch"` // "master"
|
||||
HeadSha string `json:"head_sha"` // "acb5820ced9479c074f688cc328bf03f341a511d"
|
||||
RunNumber int64 `json:"run_number"` // 562
|
||||
CheckSuiteID int64 `json:"check_suite_id"` // 414944374
|
||||
Event string `json:"event"` // "push"
|
||||
Status string `json:"status"` // "queued"
|
||||
Conclusion *string `json:"conclusion"` // null
|
||||
URL string `json:"url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642"
|
||||
HTMLURL string `json:"html_url"` // "https://github.com/octo-org/octo-repo/actions/runs/30433642"
|
||||
CreatedAt string `json:"created_at"` // "2020-01-22T19:33:08Z"
|
||||
UpdatedAt string `json:"updated_at"` // "2020-01-22T19:33:08Z"
|
||||
JobsURL string `json:"jobs_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs"
|
||||
LogsURL string `json:"logs_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs"
|
||||
ArtifactsURL string `json:"artifacts_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts"
|
||||
CancelURL string `json:"cancel_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel"
|
||||
RerunURL string `json:"rerun_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun"
|
||||
WorkflowURL string `json:"workflow_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/30433642"
|
||||
HeadCommit Commit `json:"head_commit"`
|
||||
Repository Repository `json:"repository"`
|
||||
HeadRepository Repository `json:"head_repository"`
|
||||
}
|
||||
|
||||
type WorkflowRunsListResponse struct {
|
||||
TotalCount int64 `json:"total_count"`
|
||||
Runs []WorkflowRunResponse `json:"workflow_runs"`
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
module github.com/spotify/backstage/builds
|
||||
|
||||
go 1.12
|
||||
|
||||
replace github.com/spotify/backstage/proto => ../proto
|
||||
|
||||
require (
|
||||
github.com/prometheus/common v0.9.1
|
||||
github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000
|
||||
google.golang.org/grpc v1.27.1
|
||||
)
|
||||
@@ -1,117 +0,0 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
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/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@@ -1,42 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
|
||||
"github.com/spotify/backstage/builds/ghactions"
|
||||
"github.com/spotify/backstage/builds/service"
|
||||
buildsv1 "github.com/spotify/backstage/proto/builds/v1"
|
||||
inventoryv1 "github.com/spotify/backstage/proto/inventory/v1"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
port = ":50051"
|
||||
)
|
||||
|
||||
func main() {
|
||||
lis, err := net.Listen("tcp", port)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to listen: %v", err)
|
||||
}
|
||||
grpcServer := grpc.NewServer()
|
||||
|
||||
conn, err := grpc.Dial("inventory:50051", grpc.WithInsecure())
|
||||
if err != nil {
|
||||
log.Fatal("Cannot connect to inventory service")
|
||||
}
|
||||
|
||||
inventory := inventoryv1.NewInventoryClient(conn)
|
||||
|
||||
ghClient, err := ghactions.NewFromEnv()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create github client, %s", err)
|
||||
}
|
||||
|
||||
buildsv1.RegisterBuildsServer(grpcServer, service.New(ghClient, inventory))
|
||||
|
||||
log.Println("Serving Builds Service")
|
||||
grpcServer.Serve(lis)
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/prometheus/common/log"
|
||||
"github.com/spotify/backstage/builds/ghactions"
|
||||
buildsv1 "github.com/spotify/backstage/proto/builds/v1"
|
||||
inventoryv1 "github.com/spotify/backstage/proto/inventory/v1"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type service struct {
|
||||
ghClient *ghactions.Client
|
||||
inventory inventoryv1.InventoryClient
|
||||
}
|
||||
|
||||
var _ buildsv1.BuildsServer = (*service)(nil)
|
||||
|
||||
// New creates a new identity data server
|
||||
func New(ghClient *ghactions.Client, inventory inventoryv1.InventoryClient) buildsv1.BuildsServer {
|
||||
return &service{ghClient, inventory}
|
||||
}
|
||||
|
||||
func (s *service) ListBuilds(ctx context.Context, req *buildsv1.ListBuildsRequest) (*buildsv1.ListBuildsReply, error) {
|
||||
uri := req.GetEntityUri()
|
||||
|
||||
owner := "spotify"
|
||||
repo := "backstage"
|
||||
|
||||
ownerReq, err := s.inventory.GetFact(ctx, &inventoryv1.GetFactRequest{
|
||||
EntityUri: uri,
|
||||
Name: "githubOwner",
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("Failed to fetch owner for %s, defaulting to %s", uri, owner)
|
||||
}
|
||||
if ownerReq.GetFact().GetValue() != "" {
|
||||
owner = ownerReq.Fact.GetValue()
|
||||
} else {
|
||||
log.Errorf("No owner found for %s, defaulting to %s", uri, owner)
|
||||
}
|
||||
|
||||
repotReq, err := s.inventory.GetFact(ctx, &inventoryv1.GetFactRequest{
|
||||
EntityUri: uri,
|
||||
Name: "githubRepo",
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("Failed to fetch repo for %s, defaulting to %s", uri, repo)
|
||||
}
|
||||
if repotReq.GetFact().GetValue() != "" {
|
||||
repo = repotReq.GetFact().GetValue()
|
||||
} else {
|
||||
log.Errorf("No repo found for %s, defaulting to %s", uri, owner)
|
||||
}
|
||||
|
||||
result, err := s.ghClient.ListWorkflowRuns(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Failed to fetch workflow runs for %s/%s, %s", owner, repo, err)
|
||||
}
|
||||
|
||||
builds := make([]*buildsv1.Build, len(result.Runs))
|
||||
|
||||
for i, run := range result.Runs {
|
||||
builds[i] = s.transformBuild(owner, repo, &run)
|
||||
}
|
||||
|
||||
return &buildsv1.ListBuildsReply{
|
||||
EntityUri: "",
|
||||
Builds: builds,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *service) GetBuild(ctx context.Context, req *buildsv1.GetBuildRequest) (*buildsv1.GetBuildReply, error) {
|
||||
uri := req.GetBuildUri()
|
||||
|
||||
owner, repo, runID, err := s.parseBuildURI(uri)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Invalid build URI '%s', %s", uri, err)
|
||||
}
|
||||
|
||||
run, err := s.ghClient.GetWorkflowRun(ctx, owner, repo, runID)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Failed to fetch workflow run for %s/%s/%s, %s", owner, repo, runID, err)
|
||||
}
|
||||
if run == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "Workflow run %s/%s/%s not found", owner, repo, runID)
|
||||
}
|
||||
|
||||
return &buildsv1.GetBuildReply{
|
||||
Build: s.transformBuild(owner, repo, run),
|
||||
Details: &buildsv1.BuildDetails{
|
||||
Author: run.HeadCommit.Author.Name,
|
||||
LogUrl: run.LogsURL,
|
||||
OverviewUrl: run.HTMLURL,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *service) transformBuild(owner, repo string, run *ghactions.WorkflowRunResponse) *buildsv1.Build {
|
||||
stat := buildsv1.BuildStatus_NULL
|
||||
switch run.Status {
|
||||
case "queued":
|
||||
stat = buildsv1.BuildStatus_PENDING
|
||||
case "in_progress":
|
||||
stat = buildsv1.BuildStatus_RUNNING
|
||||
case "completed":
|
||||
if run.Conclusion != nil {
|
||||
switch *run.Conclusion {
|
||||
case "success":
|
||||
stat = buildsv1.BuildStatus_SUCCESS
|
||||
case "neutral":
|
||||
stat = buildsv1.BuildStatus_SUCCESS
|
||||
case "failure":
|
||||
stat = buildsv1.BuildStatus_FAILURE
|
||||
case "cancelled":
|
||||
stat = buildsv1.BuildStatus_FAILURE
|
||||
case "timed_out":
|
||||
stat = buildsv1.BuildStatus_FAILURE
|
||||
case "action_required":
|
||||
stat = buildsv1.BuildStatus_RUNNING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &buildsv1.Build{
|
||||
Uri: fmt.Sprintf("entity:build:%s/%s/%d", owner, repo, run.ID),
|
||||
CommitId: run.HeadCommit.ID,
|
||||
Message: run.HeadCommit.Message,
|
||||
Branch: run.HeadBranch,
|
||||
Status: stat,
|
||||
}
|
||||
}
|
||||
|
||||
var buildURIRegex = regexp.MustCompile("^entity:build:([^/:]+)/([^/:]+)/([^/:]+)$")
|
||||
|
||||
func (s *service) parseBuildURI(uri string) (owner, repo, runID string, err error) {
|
||||
if uri == "" {
|
||||
return "", "", "", fmt.Errorf("uri is empty")
|
||||
}
|
||||
|
||||
match := buildURIRegex.FindStringSubmatch(uri)
|
||||
if match == nil {
|
||||
return "", "", "", fmt.Errorf("uri does not match")
|
||||
}
|
||||
|
||||
return match[1], match[2], match[3], nil
|
||||
}
|
||||
|
||||
var entityURIRegex = regexp.MustCompile("^entity:([^:]+):([^:]+)$")
|
||||
|
||||
func (s *service) parseEntityURI(uri string) (kind, id string, err error) {
|
||||
if uri == "" {
|
||||
return "", "", fmt.Errorf("uri is empty")
|
||||
}
|
||||
|
||||
match := entityURIRegex.FindStringSubmatch(uri)
|
||||
if match == nil {
|
||||
return "", "", fmt.Errorf("uri does not match")
|
||||
}
|
||||
|
||||
return match[1], match[2], nil
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env docker-compose -f
|
||||
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
proxy:
|
||||
container_name: boss-proxy
|
||||
build:
|
||||
context: proxy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:80"
|
||||
|
||||
identity:
|
||||
container_name: boss-identity
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
service: identity
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./identity/identity-data.json:/app/identity-data.json
|
||||
|
||||
# inventory:
|
||||
# container_name: boss-inventory
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# service: inventory
|
||||
# restart: unless-stopped
|
||||
# volumes:
|
||||
# - ./inventory/inventory.db:/app/inventory.db
|
||||
|
||||
# builds:
|
||||
# container_name: boss-builds
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# service: builds
|
||||
# restart: unless-stopped
|
||||
# depends_on:
|
||||
# - inventory
|
||||
# links:
|
||||
# - inventory
|
||||
|
||||
# scaffolder:
|
||||
# depends_on:
|
||||
# - inventory
|
||||
# links:
|
||||
# - inventory
|
||||
# build:
|
||||
# context: .
|
||||
# args:
|
||||
# service: scaffolder
|
||||
# base_image: scaffolder
|
||||
# restart: unless-stopped
|
||||
# volumes:
|
||||
# - ./scaffolder/templates:/app/templates:ro
|
||||
@@ -1 +0,0 @@
|
||||
identity
|
||||
@@ -1,21 +0,0 @@
|
||||
# Backstage Identity Service
|
||||
|
||||
Mock implementation of Backstage Indentity service API.
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
$ go build .
|
||||
|
||||
$ ./identity
|
||||
```
|
||||
|
||||
Try it out from `proto/` folder:
|
||||
|
||||
```sh
|
||||
prototool grpc identity \
|
||||
--address 0.0.0.0:50051 \
|
||||
--method spotify.backstage.identity.v1.Identity/GetUser \
|
||||
--data '{"id":"patriko"}' \
|
||||
--details
|
||||
```
|
||||
@@ -1,14 +0,0 @@
|
||||
module github.com/spotify/backstage/identity
|
||||
|
||||
go 1.13
|
||||
|
||||
replace github.com/spotify/backstage/proto => ../proto
|
||||
|
||||
require (
|
||||
github.com/golang/mock v1.1.1
|
||||
github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect
|
||||
google.golang.org/grpc v1.27.0
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
|
||||
)
|
||||
@@ -1,51 +0,0 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"users": [
|
||||
{
|
||||
"id": "rugvip",
|
||||
"name": "Patrik",
|
||||
"groups": ["backstage"]
|
||||
}
|
||||
],
|
||||
"groups": [
|
||||
{
|
||||
"id": "spotify",
|
||||
"groups": ["backstage", "scio"]
|
||||
},
|
||||
{
|
||||
"id": "backstage",
|
||||
"groups": []
|
||||
},
|
||||
{
|
||||
"id": "scio",
|
||||
"groups": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
|
||||
"github.com/spotify/backstage/identity/model"
|
||||
"github.com/spotify/backstage/identity/service"
|
||||
|
||||
identityv1 "github.com/spotify/backstage/proto/identity/v1"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
port = ":50051"
|
||||
dataPath = "./identity-data.json"
|
||||
)
|
||||
|
||||
func main() {
|
||||
data, err := model.LoadIdentityData(dataPath)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to load identity data, %s", err)
|
||||
}
|
||||
|
||||
lis, err := net.Listen("tcp", port)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
|
||||
grpcServer := grpc.NewServer()
|
||||
identityv1.RegisterIdentityServer(grpcServer, service.New(data))
|
||||
|
||||
log.Println("Serving Identity Service")
|
||||
grpcServer.Serve(lis)
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type IdentityFileData struct {
|
||||
Users []struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Groups []string `json:"groups"`
|
||||
}
|
||||
Groups []struct {
|
||||
ID string `json:"id"`
|
||||
Groups []string `json:"groups"`
|
||||
}
|
||||
}
|
||||
|
||||
// LoadIdentityData loads identity data from a json file.
|
||||
func LoadIdentityData(path string) (*IdentityData, error) {
|
||||
data, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var identityFileData IdentityFileData
|
||||
if err := json.Unmarshal(data, &identityFileData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
identityData := IdentityData{
|
||||
Users: map[string]User{},
|
||||
Groups: map[string]Group{},
|
||||
}
|
||||
|
||||
for _, user := range identityFileData.Users {
|
||||
identityData.Users[user.ID] = User{
|
||||
ID: user.ID,
|
||||
Name: user.Name,
|
||||
Groups: user.Groups,
|
||||
}
|
||||
}
|
||||
|
||||
for _, group := range identityFileData.Groups {
|
||||
identityData.Groups[group.ID] = Group{
|
||||
ID: group.ID,
|
||||
Groups: group.Groups,
|
||||
}
|
||||
}
|
||||
|
||||
return &identityData, nil
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package model
|
||||
|
||||
type IdentityData struct {
|
||||
Users map[string]User
|
||||
Groups map[string]Group
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID string
|
||||
Name string
|
||||
Groups []string
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
ID string
|
||||
Users []string
|
||||
Groups []string
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/spotify/backstage/identity/model"
|
||||
identityv1 "github.com/spotify/backstage/proto/identity/v1"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type identityDataServer model.IdentityData
|
||||
|
||||
// New creates a new identity data server
|
||||
func New(data *model.IdentityData) identityv1.IdentityServer {
|
||||
return (*identityDataServer)(data)
|
||||
}
|
||||
|
||||
func (s *identityDataServer) GetUser(ctx context.Context, req *identityv1.GetUserRequest) (*identityv1.GetUserReply, error) {
|
||||
id := req.GetId()
|
||||
if id == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "ID is required in GetUserRequest")
|
||||
}
|
||||
|
||||
user, ok := s.Users[id]
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.NotFound, "User '%s' not found", id)
|
||||
}
|
||||
|
||||
var replyGroups []*identityv1.Group
|
||||
for _, groupID := range user.Groups {
|
||||
replyGroups = append(replyGroups, &identityv1.Group{
|
||||
Id: groupID,
|
||||
})
|
||||
}
|
||||
|
||||
return &identityv1.GetUserReply{
|
||||
User: &identityv1.User{Id: user.ID, Name: user.Name},
|
||||
Groups: replyGroups,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *identityDataServer) GetGroup(ctx context.Context, req *identityv1.GetGroupRequest) (*identityv1.GetGroupReply, error) {
|
||||
id := req.GetId()
|
||||
if id == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "ID is required in GetGroupRequest")
|
||||
}
|
||||
|
||||
group, ok := s.Groups[id]
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.NotFound, "Group '%s' not found", id)
|
||||
}
|
||||
|
||||
var replyUsers []*identityv1.User
|
||||
for _, userID := range group.Users {
|
||||
replyUsers = append(replyUsers, &identityv1.User{
|
||||
Id: userID,
|
||||
})
|
||||
}
|
||||
|
||||
var replyGroups []*identityv1.Group
|
||||
for _, groupID := range group.Groups {
|
||||
replyGroups = append(replyGroups, &identityv1.Group{
|
||||
Id: groupID,
|
||||
})
|
||||
}
|
||||
|
||||
return &identityv1.GetGroupReply{
|
||||
Group: &identityv1.Group{Id: group.ID, Users: replyUsers, Groups: replyGroups},
|
||||
}, nil
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/spotify/backstage/inventory/storage"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
pb "github.com/spotify/backstage/proto/inventory/v1"
|
||||
)
|
||||
|
||||
// Server is the inventory Grpc server
|
||||
type Server struct {
|
||||
Storage *storage.Storage
|
||||
}
|
||||
|
||||
func (s *Server) ListEntities(ctx context.Context, req *pb.ListEntitiesRequest) (*pb.ListEntitiesReply, error) {
|
||||
entities, err := s.Storage.ListEntities(req.UriPrefix)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, "could not list entities")
|
||||
}
|
||||
|
||||
var result []*pb.Entity
|
||||
for _, entity := range entities {
|
||||
var facts []*pb.Fact
|
||||
factTuples, err := s.Storage.GetFacts(entity)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get facts for %v", entity))
|
||||
}
|
||||
for key, value := range factTuples {
|
||||
facts = append(facts, &pb.Fact{Name: key, Value: value})
|
||||
}
|
||||
result = append(result, &pb.Entity{Uri: entity, Facts: facts})
|
||||
}
|
||||
|
||||
return &pb.ListEntitiesReply{Entities: result}, nil
|
||||
}
|
||||
|
||||
func (s *Server) CreateEntity(ctx context.Context, req *pb.CreateEntityRequest) (*pb.CreateEntityReply, error) {
|
||||
uri := req.GetEntity().GetUri()
|
||||
err := s.Storage.CreateEntity(uri)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, "could not create entity")
|
||||
}
|
||||
for _, fact := range req.GetEntity().GetFacts() {
|
||||
if fact.GetName() != "" {
|
||||
if err := s.Storage.SetFact(uri, fact.GetName(), fact.GetValue()); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to set fact %s, %s", fact.GetName(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return &pb.CreateEntityReply{Entity: req.GetEntity()}, nil
|
||||
}
|
||||
|
||||
// GetEntity returns an inventory Entity with the selected facts
|
||||
func (s *Server) GetEntity(ctx context.Context, req *pb.GetEntityRequest) (*pb.GetEntityReply, error) {
|
||||
var facts []*pb.Fact
|
||||
|
||||
entityUri, err := s.Storage.GetEntity(req.GetEntity().GetUri())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get entity %v", err))
|
||||
}
|
||||
|
||||
factTuples, err := s.Storage.GetFacts(entityUri)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("could not get facts for %v", entityUri))
|
||||
}
|
||||
|
||||
for key, value := range factTuples {
|
||||
facts = append(facts, &pb.Fact{Name: key, Value: value})
|
||||
}
|
||||
return &pb.GetEntityReply{Entity: &pb.Entity{Uri: entityUri, Facts: facts}}, nil
|
||||
}
|
||||
|
||||
func (s *Server) SetFact(ctx context.Context, req *pb.SetFactRequest) (*pb.SetFactReply, error) {
|
||||
err := s.Storage.SetFact(req.EntityUri, req.Name, req.Value)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, "could not set fact")
|
||||
}
|
||||
return &pb.SetFactReply{Fact: &pb.Fact{Name: req.GetName(), Value: req.GetValue()}}, nil
|
||||
}
|
||||
|
||||
func (s *Server) GetFact(ctx context.Context, req *pb.GetFactRequest) (*pb.GetFactReply, error) {
|
||||
val, err := s.Storage.GetFact(req.EntityUri, req.Name)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, "could not set fact")
|
||||
}
|
||||
return &pb.GetFactReply{Fact: &pb.Fact{Name: req.GetName(), Value: val}}, nil
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/spotify/backstage/inventory/storage"
|
||||
|
||||
pb "github.com/spotify/backstage/proto/inventory/v1"
|
||||
)
|
||||
|
||||
var entityURI = "entity:test:test"
|
||||
|
||||
func TestServer(t *testing.T) {
|
||||
testStorage := NewTestStorage()
|
||||
defer testStorage.Close()
|
||||
s := Server{Storage: testStorage.Storage}
|
||||
|
||||
t.Run("Listing Entities matching prefix", func(t *testing.T) {
|
||||
entity := &pb.Entity{Uri: entityURI}
|
||||
|
||||
s.CreateEntity(context.Background(), &pb.CreateEntityRequest{Entity: entity})
|
||||
setFactReq := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
|
||||
s.SetFact(context.Background(), setFactReq)
|
||||
|
||||
list, err := s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: ""})
|
||||
if err != nil {
|
||||
t.Errorf("ServerTest(ListEntities) could not list: %v", err)
|
||||
}
|
||||
if len(list.GetEntities()) != 1 {
|
||||
t.Errorf("ServerTest(ListEntities) expected %v items, got %v", 1, len(list.GetEntities()))
|
||||
}
|
||||
if list.GetEntities()[0].GetUri() != entityURI {
|
||||
t.Errorf("ServerTest(ListEntities) expected uri %v, got %v", "entity:test:test", list.GetEntities()[0].GetUri())
|
||||
}
|
||||
expectedFacts := []*pb.Fact{{Name: "test-name", Value: "test-value"}}
|
||||
if !reflect.DeepEqual(list.GetEntities()[0].GetFacts(), expectedFacts) {
|
||||
t.Errorf("ServerTest(ListEntities) got %v, wanted %v", list.GetEntities()[0].GetFacts(), expectedFacts)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Listing Entities not matching prefix", func(t *testing.T) {
|
||||
entity := &pb.Entity{Uri: entityURI}
|
||||
|
||||
s.CreateEntity(context.Background(), &pb.CreateEntityRequest{Entity: entity})
|
||||
list, err := s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: "entity:test2"})
|
||||
if err != nil {
|
||||
t.Errorf("ServerTest(TestServerListEntities) could not list: %v", err)
|
||||
}
|
||||
if len(list.GetEntities()) != 0 {
|
||||
t.Errorf("ServerTest(TestServerListEntities) expected %v items, got %v", 0, len(list.GetEntities()))
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Creating entity", func(t *testing.T) {
|
||||
entity := &pb.Entity{Uri: entityURI}
|
||||
createReq := &pb.CreateEntityRequest{Entity: entity}
|
||||
resp, err := s.CreateEntity(context.Background(), createReq)
|
||||
if err != nil {
|
||||
t.Errorf("ServerTest(CreateEntity) got unexpected error %v", err)
|
||||
}
|
||||
if resp.GetEntity().GetUri() != entity.GetUri() {
|
||||
t.Errorf("ServerTest(CreateEntity) expected %v, but got %v", entity.GetUri(), resp.GetEntity().GetUri())
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Get entity with included facts", func(t *testing.T) {
|
||||
setFactReq := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
|
||||
s.SetFact(context.Background(), setFactReq)
|
||||
|
||||
entity := &pb.Entity{Uri: entityURI}
|
||||
req := &pb.GetEntityRequest{Entity: entity}
|
||||
|
||||
resp, err := s.GetEntity(context.Background(), req)
|
||||
if err != nil {
|
||||
t.Errorf("ServerTest(GetEntity) got unexpected error %v", err)
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("ServerTest(GetEntity) returned nil")
|
||||
}
|
||||
expectedFacts := []*pb.Fact{{Name: "test-name", Value: "test-value"}}
|
||||
if !reflect.DeepEqual(resp.GetEntity().GetFacts(), expectedFacts) {
|
||||
t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetEntity().GetFacts(), expectedFacts)
|
||||
}
|
||||
})
|
||||
t.Run("Set fact for existing entity", func(t *testing.T) {
|
||||
entity := &pb.Entity{Uri: entityURI}
|
||||
createReq := &pb.CreateEntityRequest{Entity: entity}
|
||||
s.CreateEntity(context.Background(), createReq)
|
||||
|
||||
req := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
|
||||
resp, err := s.SetFact(context.Background(), req)
|
||||
if err != nil {
|
||||
t.Errorf("ServerTest(SetFact) got unexpected error %v", err)
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("ServerTest(SetFact) returned nil")
|
||||
}
|
||||
|
||||
fact := &pb.Fact{Name: req.GetName(), Value: req.GetValue()}
|
||||
assertFact(t, resp.GetFact(), fact)
|
||||
})
|
||||
|
||||
t.Run("Set fact for non-existing entity", func(t *testing.T) {
|
||||
req := &pb.SetFactRequest{EntityUri: entityURI, Name: "test-name", Value: "test-value"}
|
||||
resp, err := s.SetFact(context.Background(), req)
|
||||
if err != nil {
|
||||
t.Errorf("ServerTest(SetFact) got unexpected error %v", err)
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("ServerTest(SetFact) returned nil")
|
||||
}
|
||||
|
||||
fact := &pb.Fact{Name: req.GetName(), Value: req.GetValue()}
|
||||
assertFact(t, resp.GetFact(), fact)
|
||||
})
|
||||
}
|
||||
|
||||
func assertFact(t *testing.T, got, want *pb.Fact) {
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ServerTest(SetFact) got %v, wanted %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
type TestStorage struct {
|
||||
Storage *storage.Storage
|
||||
Path string
|
||||
}
|
||||
|
||||
// NewTestStorage returns a TestStorage using a temporary path.
|
||||
func NewTestStorage() *TestStorage {
|
||||
f, err := ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("temp file: %s", err))
|
||||
}
|
||||
path := f.Name()
|
||||
f.Close()
|
||||
os.Remove(path)
|
||||
|
||||
config := storage.Config{Path: path}
|
||||
storage, _ := storage.OpenStorage(config)
|
||||
return &TestStorage{Storage: storage, Path: path}
|
||||
}
|
||||
|
||||
func (db *TestStorage) Close() {
|
||||
defer os.Remove(db.Path)
|
||||
db.Storage.Close()
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spotify/backstage/inventory/storage"
|
||||
"os"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/kardianos/osext"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Config struct holds the current configuration
|
||||
type Config struct {
|
||||
Server struct {
|
||||
Address string
|
||||
Port int
|
||||
}
|
||||
|
||||
Logging struct {
|
||||
Format string
|
||||
Level string
|
||||
}
|
||||
|
||||
DB storage.Config
|
||||
}
|
||||
|
||||
// Initialize a new Config
|
||||
func Initialize(configFile string) *Config {
|
||||
cfg := DefaultConfig()
|
||||
ReadConfigFile(cfg, getConfigFilePath(configFile))
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
// DefaultConfig returns a Config struct with default values
|
||||
func DefaultConfig() *Config {
|
||||
cfg := &Config{}
|
||||
|
||||
cfg.Server.Address = "0.0.0.0"
|
||||
cfg.Server.Port = 50051
|
||||
|
||||
cfg.Logging.Format = "text"
|
||||
cfg.Logging.Level = "DEBUG"
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
func getConfigFilePath(configPath string) string {
|
||||
if configPath != "" {
|
||||
if _, err := os.Stat(configPath); err == nil {
|
||||
return configPath
|
||||
}
|
||||
panic(fmt.Sprintf("unable to open %s.", configPath))
|
||||
}
|
||||
path, _ := osext.ExecutableFolder()
|
||||
path = fmt.Sprintf("%s/config.toml", path)
|
||||
if _, err := os.Open(path); err == nil {
|
||||
return path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func ReadConfigFile(cfg *Config, path string) {
|
||||
_, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := toml.DecodeFile(path, cfg); err != nil {
|
||||
logrus.WithError(err).Fatal("unable to read config")
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
module github.com/spotify/backstage/inventory
|
||||
|
||||
go 1.12
|
||||
|
||||
replace github.com/spotify/backstage/proto => ../proto
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/golang/protobuf v1.3.3
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
|
||||
github.com/sirupsen/logrus v1.4.2
|
||||
github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000
|
||||
go.etcd.io/bbolt v1.3.3
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135
|
||||
google.golang.org/grpc v1.27.0
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc
|
||||
)
|
||||
@@ -1,63 +0,0 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@@ -1,74 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/spotify/backstage/inventory/config"
|
||||
"github.com/spotify/backstage/inventory/storage"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"github.com/spotify/backstage/inventory/app"
|
||||
pb "github.com/spotify/backstage/proto/inventory/v1"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
configFile := flag.String("config", "", "specify a config.toml file")
|
||||
flag.Parse()
|
||||
go catchInterrupt()
|
||||
|
||||
cfg := config.Initialize(*configFile)
|
||||
setupLogging(cfg)
|
||||
storage := getStorage(cfg)
|
||||
|
||||
address := fmt.Sprintf("%v:%v", cfg.Server.Address, cfg.Server.Port)
|
||||
lis, err := net.Listen("tcp", address)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
log.Infof("inventory service listening on: %v", address)
|
||||
|
||||
grpcServer := grpc.NewServer()
|
||||
pb.RegisterInventoryServer(grpcServer, &app.Server{Storage: storage})
|
||||
grpcServer.Serve(lis)
|
||||
}
|
||||
|
||||
func getStorage(cfg *config.Config) *storage.Storage {
|
||||
storage, err := storage.OpenStorage(cfg.DB)
|
||||
if err != nil {
|
||||
log.Fatalf("could not open database: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return storage
|
||||
}
|
||||
|
||||
func setupLogging(cfg *config.Config) {
|
||||
if cfg.Logging.Format == "json" {
|
||||
log.SetFormatter(&log.JSONFormatter{
|
||||
FieldMap: log.FieldMap{
|
||||
log.FieldKeyLevel: "severity",
|
||||
},
|
||||
})
|
||||
}
|
||||
level, err := log.ParseLevel(cfg.Logging.Level)
|
||||
if err != nil {
|
||||
level = log.InfoLevel
|
||||
}
|
||||
log.SetOutput(os.Stdout)
|
||||
log.SetLevel(level)
|
||||
}
|
||||
|
||||
func catchInterrupt() {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, os.Kill)
|
||||
s := <-c
|
||||
if s != os.Interrupt && s != os.Kill {
|
||||
return
|
||||
}
|
||||
log.Info("shutting down...")
|
||||
os.Exit(0)
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Path string
|
||||
Mode os.FileMode
|
||||
}
|
||||
|
||||
type Storage struct {
|
||||
db *bbolt.DB
|
||||
}
|
||||
|
||||
func OpenStorage(config Config) (*Storage, error) {
|
||||
if config.Path == "" {
|
||||
config.Path = "inventory.db"
|
||||
}
|
||||
if config.Mode == 0 {
|
||||
config.Mode = 0600
|
||||
}
|
||||
db, err := bbolt.Open(config.Path, config.Mode, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Storage{
|
||||
db: db,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Storage) Close() error {
|
||||
return s.db.Close()
|
||||
}
|
||||
|
||||
func (s *Storage) SetFact(entityUri, name, value string) (err error) {
|
||||
return s.db.Update(func(tx *bbolt.Tx) error {
|
||||
b, err := tx.CreateBucketIfNotExists([]byte(entityUri))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = b.Put([]byte(name), []byte(value))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Storage) GetFact(entityUri, name string) (string, error) {
|
||||
var value string
|
||||
|
||||
err := s.db.View(func(tx *bbolt.Tx) error {
|
||||
b := tx.Bucket([]byte(entityUri))
|
||||
if b == nil {
|
||||
return fmt.Errorf("bucket '%s' does not exist", entityUri)
|
||||
}
|
||||
value = string(b.Get([]byte(name)))
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func (s *Storage) ListEntities(uriPrefix string) ([]string, error) {
|
||||
entities := []string{}
|
||||
err := s.db.View(func(tx *bbolt.Tx) error {
|
||||
err := tx.ForEach(func(name []byte, b *bbolt.Bucket) error {
|
||||
namestring := string(name)
|
||||
if uriPrefix == "" || strings.HasPrefix(namestring, uriPrefix) {
|
||||
entities = append(entities, namestring)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return entities, nil
|
||||
}
|
||||
|
||||
func (s *Storage) CreateEntity(entityUri string) error {
|
||||
return s.db.Update(func(tx *bbolt.Tx) error {
|
||||
_, err := tx.CreateBucketIfNotExists([]byte(entityUri))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Storage) GetEntity(entityUri string) (string, error) {
|
||||
err := s.db.View(func(tx *bbolt.Tx) error {
|
||||
b := tx.Bucket([]byte(entityUri))
|
||||
if b == nil {
|
||||
return fmt.Errorf("bucket '%s' does not exist", entityUri)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return entityUri, nil
|
||||
}
|
||||
|
||||
func (s *Storage) GetFacts(entityUri string) (map[string]string, error) {
|
||||
facts := make(map[string]string)
|
||||
|
||||
err := s.db.View(func(tx *bbolt.Tx) error {
|
||||
entityBucket := tx.Bucket([]byte(entityUri))
|
||||
if entityBucket == nil {
|
||||
return fmt.Errorf("bucket '%s' does not exist", entityUri)
|
||||
}
|
||||
c := entityBucket.Cursor()
|
||||
for k, v := c.First(); k != nil; k, v = c.Next() {
|
||||
facts[string(k)] = string(v)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return facts, nil
|
||||
}
|
||||
@@ -1,518 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: builds/v1/builds.proto
|
||||
|
||||
package buildsv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type BuildStatus int32
|
||||
|
||||
const (
|
||||
BuildStatus_NULL BuildStatus = 0
|
||||
BuildStatus_SUCCESS BuildStatus = 1
|
||||
BuildStatus_FAILURE BuildStatus = 2
|
||||
BuildStatus_PENDING BuildStatus = 3
|
||||
BuildStatus_RUNNING BuildStatus = 4
|
||||
)
|
||||
|
||||
var BuildStatus_name = map[int32]string{
|
||||
0: "NULL",
|
||||
1: "SUCCESS",
|
||||
2: "FAILURE",
|
||||
3: "PENDING",
|
||||
4: "RUNNING",
|
||||
}
|
||||
|
||||
var BuildStatus_value = map[string]int32{
|
||||
"NULL": 0,
|
||||
"SUCCESS": 1,
|
||||
"FAILURE": 2,
|
||||
"PENDING": 3,
|
||||
"RUNNING": 4,
|
||||
}
|
||||
|
||||
func (x BuildStatus) String() string {
|
||||
return proto.EnumName(BuildStatus_name, int32(x))
|
||||
}
|
||||
|
||||
func (BuildStatus) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{0}
|
||||
}
|
||||
|
||||
type ListBuildsRequest struct {
|
||||
EntityUri string `protobuf:"bytes,1,opt,name=entity_uri,json=entityUri,proto3" json:"entity_uri,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListBuildsRequest) Reset() { *m = ListBuildsRequest{} }
|
||||
func (m *ListBuildsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListBuildsRequest) ProtoMessage() {}
|
||||
func (*ListBuildsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{0}
|
||||
}
|
||||
|
||||
func (m *ListBuildsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListBuildsRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListBuildsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListBuildsRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListBuildsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListBuildsRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ListBuildsRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListBuildsRequest.Size(m)
|
||||
}
|
||||
func (m *ListBuildsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListBuildsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListBuildsRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListBuildsRequest) GetEntityUri() string {
|
||||
if m != nil {
|
||||
return m.EntityUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListBuildsReply struct {
|
||||
EntityUri string `protobuf:"bytes,1,opt,name=entity_uri,json=entityUri,proto3" json:"entity_uri,omitempty"`
|
||||
Builds []*Build `protobuf:"bytes,2,rep,name=builds,proto3" json:"builds,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListBuildsReply) Reset() { *m = ListBuildsReply{} }
|
||||
func (m *ListBuildsReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListBuildsReply) ProtoMessage() {}
|
||||
func (*ListBuildsReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{1}
|
||||
}
|
||||
|
||||
func (m *ListBuildsReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListBuildsReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListBuildsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListBuildsReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListBuildsReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListBuildsReply.Merge(m, src)
|
||||
}
|
||||
func (m *ListBuildsReply) XXX_Size() int {
|
||||
return xxx_messageInfo_ListBuildsReply.Size(m)
|
||||
}
|
||||
func (m *ListBuildsReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListBuildsReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListBuildsReply proto.InternalMessageInfo
|
||||
|
||||
func (m *ListBuildsReply) GetEntityUri() string {
|
||||
if m != nil {
|
||||
return m.EntityUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ListBuildsReply) GetBuilds() []*Build {
|
||||
if m != nil {
|
||||
return m.Builds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetBuildRequest struct {
|
||||
BuildUri string `protobuf:"bytes,1,opt,name=build_uri,json=buildUri,proto3" json:"build_uri,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetBuildRequest) Reset() { *m = GetBuildRequest{} }
|
||||
func (m *GetBuildRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetBuildRequest) ProtoMessage() {}
|
||||
func (*GetBuildRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{2}
|
||||
}
|
||||
|
||||
func (m *GetBuildRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetBuildRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetBuildRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetBuildRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetBuildRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetBuildRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetBuildRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetBuildRequest.Size(m)
|
||||
}
|
||||
func (m *GetBuildRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetBuildRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetBuildRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetBuildRequest) GetBuildUri() string {
|
||||
if m != nil {
|
||||
return m.BuildUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetBuildReply struct {
|
||||
Build *Build `protobuf:"bytes,1,opt,name=build,proto3" json:"build,omitempty"`
|
||||
Details *BuildDetails `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetBuildReply) Reset() { *m = GetBuildReply{} }
|
||||
func (m *GetBuildReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetBuildReply) ProtoMessage() {}
|
||||
func (*GetBuildReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{3}
|
||||
}
|
||||
|
||||
func (m *GetBuildReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetBuildReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetBuildReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetBuildReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetBuildReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetBuildReply.Merge(m, src)
|
||||
}
|
||||
func (m *GetBuildReply) XXX_Size() int {
|
||||
return xxx_messageInfo_GetBuildReply.Size(m)
|
||||
}
|
||||
func (m *GetBuildReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetBuildReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetBuildReply proto.InternalMessageInfo
|
||||
|
||||
func (m *GetBuildReply) GetBuild() *Build {
|
||||
if m != nil {
|
||||
return m.Build
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetBuildReply) GetDetails() *BuildDetails {
|
||||
if m != nil {
|
||||
return m.Details
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Build struct {
|
||||
Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"`
|
||||
CommitId string `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
|
||||
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
Branch string `protobuf:"bytes,4,opt,name=branch,proto3" json:"branch,omitempty"`
|
||||
Status BuildStatus `protobuf:"varint,5,opt,name=status,proto3,enum=spotify.backstage.builds.v1.BuildStatus" json:"status,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Build) Reset() { *m = Build{} }
|
||||
func (m *Build) String() string { return proto.CompactTextString(m) }
|
||||
func (*Build) ProtoMessage() {}
|
||||
func (*Build) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{4}
|
||||
}
|
||||
|
||||
func (m *Build) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Build.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Build) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Build.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Build) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Build.Merge(m, src)
|
||||
}
|
||||
func (m *Build) XXX_Size() int {
|
||||
return xxx_messageInfo_Build.Size(m)
|
||||
}
|
||||
func (m *Build) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Build.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Build proto.InternalMessageInfo
|
||||
|
||||
func (m *Build) GetUri() string {
|
||||
if m != nil {
|
||||
return m.Uri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Build) GetCommitId() string {
|
||||
if m != nil {
|
||||
return m.CommitId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Build) GetMessage() string {
|
||||
if m != nil {
|
||||
return m.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Build) GetBranch() string {
|
||||
if m != nil {
|
||||
return m.Branch
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Build) GetStatus() BuildStatus {
|
||||
if m != nil {
|
||||
return m.Status
|
||||
}
|
||||
return BuildStatus_NULL
|
||||
}
|
||||
|
||||
type BuildDetails struct {
|
||||
Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"`
|
||||
OverviewUrl string `protobuf:"bytes,2,opt,name=overview_url,json=overviewUrl,proto3" json:"overview_url,omitempty"`
|
||||
LogUrl string `protobuf:"bytes,3,opt,name=log_url,json=logUrl,proto3" json:"log_url,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BuildDetails) Reset() { *m = BuildDetails{} }
|
||||
func (m *BuildDetails) String() string { return proto.CompactTextString(m) }
|
||||
func (*BuildDetails) ProtoMessage() {}
|
||||
func (*BuildDetails) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_05a627abb7f9adb4, []int{5}
|
||||
}
|
||||
|
||||
func (m *BuildDetails) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_BuildDetails.Unmarshal(m, b)
|
||||
}
|
||||
func (m *BuildDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_BuildDetails.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *BuildDetails) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_BuildDetails.Merge(m, src)
|
||||
}
|
||||
func (m *BuildDetails) XXX_Size() int {
|
||||
return xxx_messageInfo_BuildDetails.Size(m)
|
||||
}
|
||||
func (m *BuildDetails) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_BuildDetails.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_BuildDetails proto.InternalMessageInfo
|
||||
|
||||
func (m *BuildDetails) GetAuthor() string {
|
||||
if m != nil {
|
||||
return m.Author
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *BuildDetails) GetOverviewUrl() string {
|
||||
if m != nil {
|
||||
return m.OverviewUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *BuildDetails) GetLogUrl() string {
|
||||
if m != nil {
|
||||
return m.LogUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("spotify.backstage.builds.v1.BuildStatus", BuildStatus_name, BuildStatus_value)
|
||||
proto.RegisterType((*ListBuildsRequest)(nil), "spotify.backstage.builds.v1.ListBuildsRequest")
|
||||
proto.RegisterType((*ListBuildsReply)(nil), "spotify.backstage.builds.v1.ListBuildsReply")
|
||||
proto.RegisterType((*GetBuildRequest)(nil), "spotify.backstage.builds.v1.GetBuildRequest")
|
||||
proto.RegisterType((*GetBuildReply)(nil), "spotify.backstage.builds.v1.GetBuildReply")
|
||||
proto.RegisterType((*Build)(nil), "spotify.backstage.builds.v1.Build")
|
||||
proto.RegisterType((*BuildDetails)(nil), "spotify.backstage.builds.v1.BuildDetails")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("builds/v1/builds.proto", fileDescriptor_05a627abb7f9adb4) }
|
||||
|
||||
var fileDescriptor_05a627abb7f9adb4 = []byte{
|
||||
// 459 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xd1, 0x6e, 0xd3, 0x30,
|
||||
0x14, 0x25, 0x6b, 0x9b, 0xb6, 0xb7, 0x83, 0x05, 0x3f, 0x8c, 0x68, 0x13, 0x52, 0xc9, 0x53, 0x99,
|
||||
0x50, 0xa6, 0x96, 0x17, 0xc4, 0x13, 0xac, 0x2b, 0x53, 0x45, 0x15, 0x21, 0x57, 0x79, 0xe1, 0xa5,
|
||||
0x4a, 0x1a, 0xd3, 0x19, 0xdc, 0xb9, 0xd8, 0x4e, 0x50, 0x7f, 0x82, 0x0f, 0xe1, 0x93, 0xf8, 0x1a,
|
||||
0x64, 0x3b, 0x51, 0x23, 0x26, 0xb5, 0x7d, 0xf3, 0xb9, 0xe7, 0x9e, 0x9c, 0x73, 0xa5, 0x13, 0x38,
|
||||
0x4f, 0x73, 0xca, 0x32, 0x79, 0x5d, 0x0c, 0xaf, 0xed, 0x2b, 0xdc, 0x08, 0xae, 0x38, 0xba, 0x94,
|
||||
0x1b, 0xae, 0xe8, 0xb7, 0x6d, 0x98, 0x26, 0xcb, 0x1f, 0x52, 0x25, 0x2b, 0x12, 0x96, 0x7c, 0x31,
|
||||
0x0c, 0x46, 0xf0, 0x7c, 0x46, 0xa5, 0xba, 0x31, 0x03, 0x4c, 0x7e, 0xe6, 0x44, 0x2a, 0xf4, 0x12,
|
||||
0x80, 0x3c, 0x28, 0xaa, 0xb6, 0x8b, 0x5c, 0x50, 0xdf, 0xe9, 0x3b, 0x83, 0x2e, 0xee, 0xda, 0x49,
|
||||
0x2c, 0x68, 0xc0, 0xe0, 0xac, 0xae, 0xd9, 0xb0, 0xed, 0x01, 0x05, 0x7a, 0x0f, 0xae, 0xb5, 0xf4,
|
||||
0x4f, 0xfa, 0x8d, 0x41, 0x6f, 0x14, 0x84, 0x7b, 0x32, 0x85, 0xe6, 0xc3, 0xb8, 0x54, 0x04, 0x21,
|
||||
0x9c, 0xdd, 0x11, 0x6b, 0x56, 0xe5, 0xbb, 0x84, 0xae, 0x21, 0x6b, 0x66, 0x1d, 0x33, 0xd0, 0xe9,
|
||||
0x7e, 0x3b, 0xf0, 0x74, 0x27, 0xd0, 0xe1, 0xde, 0x41, 0xcb, 0xb0, 0x66, 0xf5, 0x38, 0x73, 0x2b,
|
||||
0x40, 0x63, 0x68, 0x67, 0x44, 0x25, 0x94, 0xe9, 0xe0, 0x5a, 0xfb, 0xfa, 0xb0, 0xf6, 0xd6, 0x0a,
|
||||
0x70, 0xa5, 0x0c, 0xfe, 0x38, 0xd0, 0x32, 0x0c, 0xf2, 0xa0, 0xb1, 0x4b, 0xac, 0x9f, 0xfa, 0x92,
|
||||
0x25, 0x5f, 0xaf, 0xa9, 0x5a, 0xd0, 0xcc, 0x58, 0x74, 0x71, 0xc7, 0x0e, 0xa6, 0x19, 0xf2, 0xa1,
|
||||
0xbd, 0x26, 0x52, 0x26, 0x2b, 0xe2, 0x37, 0x0c, 0x55, 0x41, 0x74, 0x0e, 0x6e, 0x2a, 0x92, 0x87,
|
||||
0xe5, 0xbd, 0xdf, 0x34, 0x44, 0x89, 0xd0, 0x07, 0x70, 0xa5, 0x4a, 0x54, 0x2e, 0xfd, 0x56, 0xdf,
|
||||
0x19, 0x3c, 0x1b, 0x0d, 0x0e, 0xc7, 0x9d, 0x9b, 0x7d, 0x5c, 0xea, 0x82, 0x14, 0x4e, 0xeb, 0x57,
|
||||
0x68, 0xa7, 0x24, 0x57, 0xf7, 0x5c, 0x94, 0xa9, 0x4b, 0x84, 0x5e, 0xc1, 0x29, 0x2f, 0x88, 0x28,
|
||||
0x28, 0xf9, 0xb5, 0xc8, 0x05, 0x2b, 0xb3, 0xf7, 0xaa, 0x59, 0x2c, 0x18, 0x7a, 0x01, 0x6d, 0xc6,
|
||||
0x57, 0x86, 0xb5, 0xf1, 0x5d, 0xc6, 0x57, 0xb1, 0x60, 0x57, 0x9f, 0xa1, 0x57, 0xb3, 0x46, 0x1d,
|
||||
0x68, 0x46, 0xf1, 0x6c, 0xe6, 0x3d, 0x41, 0x3d, 0x68, 0xcf, 0xe3, 0xf1, 0x78, 0x32, 0x9f, 0x7b,
|
||||
0x8e, 0x06, 0x9f, 0x3e, 0x4e, 0x67, 0x31, 0x9e, 0x78, 0x27, 0x1a, 0x7c, 0x99, 0x44, 0xb7, 0xd3,
|
||||
0xe8, 0xce, 0x6b, 0x68, 0x80, 0xe3, 0x28, 0xd2, 0xa0, 0x39, 0xfa, 0xeb, 0x80, 0x6b, 0x9b, 0x88,
|
||||
0xbe, 0x03, 0xec, 0x7a, 0x89, 0xc2, 0xbd, 0xb7, 0x3f, 0x2a, 0xfd, 0xc5, 0x9b, 0xa3, 0xf7, 0x75,
|
||||
0xa7, 0x32, 0xe8, 0x54, 0x25, 0x43, 0xfb, 0x95, 0xff, 0x95, 0xf7, 0xe2, 0xea, 0xc8, 0xed, 0x0d,
|
||||
0xdb, 0xde, 0xc0, 0x57, 0xdb, 0x6b, 0x59, 0x0c, 0x53, 0xd7, 0xfc, 0xcd, 0x6f, 0xff, 0x05, 0x00,
|
||||
0x00, 0xff, 0xff, 0xc2, 0xff, 0xd7, 0x62, 0xe7, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// BuildsClient is the client API for Builds service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type BuildsClient interface {
|
||||
ListBuilds(ctx context.Context, in *ListBuildsRequest, opts ...grpc.CallOption) (*ListBuildsReply, error)
|
||||
GetBuild(ctx context.Context, in *GetBuildRequest, opts ...grpc.CallOption) (*GetBuildReply, error)
|
||||
}
|
||||
|
||||
type buildsClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewBuildsClient(cc grpc.ClientConnInterface) BuildsClient {
|
||||
return &buildsClient{cc}
|
||||
}
|
||||
|
||||
func (c *buildsClient) ListBuilds(ctx context.Context, in *ListBuildsRequest, opts ...grpc.CallOption) (*ListBuildsReply, error) {
|
||||
out := new(ListBuildsReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.builds.v1.Builds/ListBuilds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *buildsClient) GetBuild(ctx context.Context, in *GetBuildRequest, opts ...grpc.CallOption) (*GetBuildReply, error) {
|
||||
out := new(GetBuildReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.builds.v1.Builds/GetBuild", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// BuildsServer is the server API for Builds service.
|
||||
type BuildsServer interface {
|
||||
ListBuilds(context.Context, *ListBuildsRequest) (*ListBuildsReply, error)
|
||||
GetBuild(context.Context, *GetBuildRequest) (*GetBuildReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedBuildsServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedBuildsServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedBuildsServer) ListBuilds(ctx context.Context, req *ListBuildsRequest) (*ListBuildsReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListBuilds not implemented")
|
||||
}
|
||||
func (*UnimplementedBuildsServer) GetBuild(ctx context.Context, req *GetBuildRequest) (*GetBuildReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBuild not implemented")
|
||||
}
|
||||
|
||||
func RegisterBuildsServer(s *grpc.Server, srv BuildsServer) {
|
||||
s.RegisterService(&_Builds_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Builds_ListBuilds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListBuildsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BuildsServer).ListBuilds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.builds.v1.Builds/ListBuilds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BuildsServer).ListBuilds(ctx, req.(*ListBuildsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Builds_GetBuild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBuildRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BuildsServer).GetBuild(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.builds.v1.Builds/GetBuild",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BuildsServer).GetBuild(ctx, req.(*GetBuildRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Builds_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "spotify.backstage.builds.v1.Builds",
|
||||
HandlerType: (*BuildsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListBuilds",
|
||||
Handler: _Builds_ListBuilds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBuild",
|
||||
Handler: _Builds_GetBuild_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "builds/v1/builds.proto",
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
module github.com/spotify/backstage/proto
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.3.3
|
||||
google.golang.org/grpc v1.27.0
|
||||
)
|
||||
@@ -1,47 +0,0 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@@ -1,447 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: identity/v1/identity.proto
|
||||
|
||||
package identityv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type GetUserRequest struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetUserRequest) Reset() { *m = GetUserRequest{} }
|
||||
func (m *GetUserRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetUserRequest) ProtoMessage() {}
|
||||
func (*GetUserRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2343b5ee8923b571, []int{0}
|
||||
}
|
||||
|
||||
func (m *GetUserRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetUserRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetUserRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetUserRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetUserRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetUserRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetUserRequest.Size(m)
|
||||
}
|
||||
func (m *GetUserRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetUserRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetUserRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetUserRequest) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetUserReply struct {
|
||||
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
|
||||
Groups []*Group `protobuf:"bytes,2,rep,name=groups,proto3" json:"groups,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetUserReply) Reset() { *m = GetUserReply{} }
|
||||
func (m *GetUserReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetUserReply) ProtoMessage() {}
|
||||
func (*GetUserReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2343b5ee8923b571, []int{1}
|
||||
}
|
||||
|
||||
func (m *GetUserReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetUserReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetUserReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetUserReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetUserReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetUserReply.Merge(m, src)
|
||||
}
|
||||
func (m *GetUserReply) XXX_Size() int {
|
||||
return xxx_messageInfo_GetUserReply.Size(m)
|
||||
}
|
||||
func (m *GetUserReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetUserReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetUserReply proto.InternalMessageInfo
|
||||
|
||||
func (m *GetUserReply) GetUser() *User {
|
||||
if m != nil {
|
||||
return m.User
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetUserReply) GetGroups() []*Group {
|
||||
if m != nil {
|
||||
return m.Groups
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetGroupRequest struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetGroupRequest) Reset() { *m = GetGroupRequest{} }
|
||||
func (m *GetGroupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetGroupRequest) ProtoMessage() {}
|
||||
func (*GetGroupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2343b5ee8923b571, []int{2}
|
||||
}
|
||||
|
||||
func (m *GetGroupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetGroupRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetGroupRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetGroupRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetGroupRequest.Size(m)
|
||||
}
|
||||
func (m *GetGroupRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetGroupRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetGroupRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetGroupRequest) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetGroupReply struct {
|
||||
Group *Group `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetGroupReply) Reset() { *m = GetGroupReply{} }
|
||||
func (m *GetGroupReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetGroupReply) ProtoMessage() {}
|
||||
func (*GetGroupReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2343b5ee8923b571, []int{3}
|
||||
}
|
||||
|
||||
func (m *GetGroupReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetGroupReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetGroupReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetGroupReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetGroupReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetGroupReply.Merge(m, src)
|
||||
}
|
||||
func (m *GetGroupReply) XXX_Size() int {
|
||||
return xxx_messageInfo_GetGroupReply.Size(m)
|
||||
}
|
||||
func (m *GetGroupReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetGroupReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetGroupReply proto.InternalMessageInfo
|
||||
|
||||
func (m *GetGroupReply) GetGroup() *Group {
|
||||
if m != nil {
|
||||
return m.Group
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *User) Reset() { *m = User{} }
|
||||
func (m *User) String() string { return proto.CompactTextString(m) }
|
||||
func (*User) ProtoMessage() {}
|
||||
func (*User) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2343b5ee8923b571, []int{4}
|
||||
}
|
||||
|
||||
func (m *User) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_User.Unmarshal(m, b)
|
||||
}
|
||||
func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_User.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *User) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_User.Merge(m, src)
|
||||
}
|
||||
func (m *User) XXX_Size() int {
|
||||
return xxx_messageInfo_User.Size(m)
|
||||
}
|
||||
func (m *User) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_User.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_User proto.InternalMessageInfo
|
||||
|
||||
func (m *User) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *User) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Users []*User `protobuf:"bytes,2,rep,name=users,proto3" json:"users,omitempty"`
|
||||
Groups []*Group `protobuf:"bytes,3,rep,name=groups,proto3" json:"groups,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Group) Reset() { *m = Group{} }
|
||||
func (m *Group) String() string { return proto.CompactTextString(m) }
|
||||
func (*Group) ProtoMessage() {}
|
||||
func (*Group) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_2343b5ee8923b571, []int{5}
|
||||
}
|
||||
|
||||
func (m *Group) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Group.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Group.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Group) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Group.Merge(m, src)
|
||||
}
|
||||
func (m *Group) XXX_Size() int {
|
||||
return xxx_messageInfo_Group.Size(m)
|
||||
}
|
||||
func (m *Group) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Group.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Group proto.InternalMessageInfo
|
||||
|
||||
func (m *Group) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Group) GetUsers() []*User {
|
||||
if m != nil {
|
||||
return m.Users
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Group) GetGroups() []*Group {
|
||||
if m != nil {
|
||||
return m.Groups
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GetUserRequest)(nil), "spotify.backstage.identity.v1.GetUserRequest")
|
||||
proto.RegisterType((*GetUserReply)(nil), "spotify.backstage.identity.v1.GetUserReply")
|
||||
proto.RegisterType((*GetGroupRequest)(nil), "spotify.backstage.identity.v1.GetGroupRequest")
|
||||
proto.RegisterType((*GetGroupReply)(nil), "spotify.backstage.identity.v1.GetGroupReply")
|
||||
proto.RegisterType((*User)(nil), "spotify.backstage.identity.v1.User")
|
||||
proto.RegisterType((*Group)(nil), "spotify.backstage.identity.v1.Group")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("identity/v1/identity.proto", fileDescriptor_2343b5ee8923b571) }
|
||||
|
||||
var fileDescriptor_2343b5ee8923b571 = []byte{
|
||||
// 303 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x4c, 0x49, 0xcd,
|
||||
0x2b, 0xc9, 0x2c, 0xa9, 0xd4, 0x2f, 0x33, 0xd4, 0x87, 0xb1, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2,
|
||||
0x85, 0x64, 0x8b, 0x0b, 0xf2, 0x4b, 0x32, 0xd3, 0x2a, 0xf5, 0x92, 0x12, 0x93, 0xb3, 0x8b, 0x4b,
|
||||
0x12, 0xd3, 0x53, 0xf5, 0xe0, 0x2a, 0xca, 0x0c, 0x95, 0x14, 0xb8, 0xf8, 0xdc, 0x53, 0x4b, 0x42,
|
||||
0x8b, 0x53, 0x8b, 0x82, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0xf8, 0xb8, 0x98, 0x32, 0x53,
|
||||
0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x98, 0x32, 0x53, 0x94, 0x5a, 0x19, 0xb9, 0x78, 0xe0,
|
||||
0x4a, 0x0a, 0x72, 0x2a, 0x85, 0xcc, 0xb9, 0x58, 0x4a, 0x8b, 0x53, 0x8b, 0xc0, 0x4a, 0xb8, 0x8d,
|
||||
0x94, 0xf5, 0xf0, 0x5a, 0xa0, 0x07, 0xd6, 0x07, 0xd6, 0x20, 0x64, 0xc3, 0xc5, 0x96, 0x5e, 0x94,
|
||||
0x5f, 0x5a, 0x50, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0x42, 0x40, 0xab, 0x3b, 0x48,
|
||||
0x71, 0x10, 0x54, 0x8f, 0x92, 0x22, 0x17, 0xbf, 0x7b, 0x6a, 0x09, 0x44, 0x0c, 0x87, 0x53, 0xbd,
|
||||
0xb9, 0x78, 0x11, 0x4a, 0x40, 0x4e, 0xb5, 0xe2, 0x62, 0x05, 0xeb, 0x86, 0xba, 0x95, 0x38, 0x0b,
|
||||
0x21, 0x5a, 0x94, 0xb4, 0xb8, 0x58, 0x40, 0x6e, 0x47, 0xb7, 0x44, 0x48, 0x88, 0x8b, 0x25, 0x2f,
|
||||
0x31, 0x37, 0x55, 0x82, 0x09, 0x2c, 0x02, 0x66, 0x2b, 0x4d, 0x60, 0xe4, 0x62, 0x05, 0x6b, 0xc6,
|
||||
0x50, 0x6d, 0xc9, 0xc5, 0x0a, 0xf2, 0x3b, 0xcc, 0xcb, 0x44, 0x85, 0x16, 0x44, 0x07, 0x52, 0x70,
|
||||
0x31, 0x93, 0x1e, 0x5c, 0x46, 0xb7, 0x19, 0xb9, 0x38, 0x3c, 0xa1, 0xb2, 0x42, 0xa9, 0x5c, 0xec,
|
||||
0xd0, 0x28, 0x14, 0xd2, 0x25, 0x64, 0x0a, 0x4a, 0x6a, 0x90, 0xd2, 0x26, 0x56, 0x39, 0x28, 0xb8,
|
||||
0x33, 0xb8, 0x38, 0x60, 0xe1, 0x2f, 0xa4, 0x47, 0x58, 0x23, 0x72, 0x5c, 0x4a, 0xe9, 0x10, 0xad,
|
||||
0xbe, 0x20, 0xa7, 0xd2, 0x89, 0x27, 0x8a, 0x0b, 0x26, 0x59, 0x66, 0x98, 0xc4, 0x06, 0x4e, 0xea,
|
||||
0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xe1, 0xa3, 0xe0, 0x08, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// IdentityClient is the client API for Identity service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type IdentityClient interface {
|
||||
// Returned user's groups will only have ID field populated
|
||||
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserReply, error)
|
||||
// Child groups will only have their ID fields populated
|
||||
// Users in the group will not have their groups popuplated
|
||||
GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*GetGroupReply, error)
|
||||
}
|
||||
|
||||
type identityClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewIdentityClient(cc grpc.ClientConnInterface) IdentityClient {
|
||||
return &identityClient{cc}
|
||||
}
|
||||
|
||||
func (c *identityClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserReply, error) {
|
||||
out := new(GetUserReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.identity.v1.Identity/GetUser", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *identityClient) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*GetGroupReply, error) {
|
||||
out := new(GetGroupReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.identity.v1.Identity/GetGroup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// IdentityServer is the server API for Identity service.
|
||||
type IdentityServer interface {
|
||||
// Returned user's groups will only have ID field populated
|
||||
GetUser(context.Context, *GetUserRequest) (*GetUserReply, error)
|
||||
// Child groups will only have their ID fields populated
|
||||
// Users in the group will not have their groups popuplated
|
||||
GetGroup(context.Context, *GetGroupRequest) (*GetGroupReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedIdentityServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedIdentityServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedIdentityServer) GetUser(ctx context.Context, req *GetUserRequest) (*GetUserReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
|
||||
}
|
||||
func (*UnimplementedIdentityServer) GetGroup(ctx context.Context, req *GetGroupRequest) (*GetGroupReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetGroup not implemented")
|
||||
}
|
||||
|
||||
func RegisterIdentityServer(s *grpc.Server, srv IdentityServer) {
|
||||
s.RegisterService(&_Identity_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Identity_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(IdentityServer).GetUser(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.identity.v1.Identity/GetUser",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(IdentityServer).GetUser(ctx, req.(*GetUserRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Identity_GetGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetGroupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(IdentityServer).GetGroup(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.identity.v1.Identity/GetGroup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(IdentityServer).GetGroup(ctx, req.(*GetGroupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Identity_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "spotify.backstage.identity.v1.Identity",
|
||||
HandlerType: (*IdentityServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetUser",
|
||||
Handler: _Identity_GetUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetGroup",
|
||||
Handler: _Identity_GetGroup_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "identity/v1/identity.proto",
|
||||
}
|
||||
@@ -1,805 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: inventory/v1/inventory.proto
|
||||
|
||||
package inventoryv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type ListEntitiesRequest struct {
|
||||
UriPrefix string `protobuf:"bytes,1,opt,name=uriPrefix,proto3" json:"uriPrefix,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListEntitiesRequest) Reset() { *m = ListEntitiesRequest{} }
|
||||
func (m *ListEntitiesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListEntitiesRequest) ProtoMessage() {}
|
||||
func (*ListEntitiesRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{0}
|
||||
}
|
||||
|
||||
func (m *ListEntitiesRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListEntitiesRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListEntitiesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListEntitiesRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListEntitiesRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListEntitiesRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ListEntitiesRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListEntitiesRequest.Size(m)
|
||||
}
|
||||
func (m *ListEntitiesRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListEntitiesRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListEntitiesRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListEntitiesRequest) GetUriPrefix() string {
|
||||
if m != nil {
|
||||
return m.UriPrefix
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListEntitiesReply struct {
|
||||
Entities []*Entity `protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListEntitiesReply) Reset() { *m = ListEntitiesReply{} }
|
||||
func (m *ListEntitiesReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListEntitiesReply) ProtoMessage() {}
|
||||
func (*ListEntitiesReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{1}
|
||||
}
|
||||
|
||||
func (m *ListEntitiesReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListEntitiesReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListEntitiesReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListEntitiesReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListEntitiesReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListEntitiesReply.Merge(m, src)
|
||||
}
|
||||
func (m *ListEntitiesReply) XXX_Size() int {
|
||||
return xxx_messageInfo_ListEntitiesReply.Size(m)
|
||||
}
|
||||
func (m *ListEntitiesReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListEntitiesReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListEntitiesReply proto.InternalMessageInfo
|
||||
|
||||
func (m *ListEntitiesReply) GetEntities() []*Entity {
|
||||
if m != nil {
|
||||
return m.Entities
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetEntityRequest struct {
|
||||
Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetEntityRequest) Reset() { *m = GetEntityRequest{} }
|
||||
func (m *GetEntityRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetEntityRequest) ProtoMessage() {}
|
||||
func (*GetEntityRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{2}
|
||||
}
|
||||
|
||||
func (m *GetEntityRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetEntityRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetEntityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetEntityRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetEntityRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetEntityRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetEntityRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetEntityRequest.Size(m)
|
||||
}
|
||||
func (m *GetEntityRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetEntityRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetEntityRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetEntityRequest) GetEntity() *Entity {
|
||||
if m != nil {
|
||||
return m.Entity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetEntityReply struct {
|
||||
Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetEntityReply) Reset() { *m = GetEntityReply{} }
|
||||
func (m *GetEntityReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetEntityReply) ProtoMessage() {}
|
||||
func (*GetEntityReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{3}
|
||||
}
|
||||
|
||||
func (m *GetEntityReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetEntityReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetEntityReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetEntityReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetEntityReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetEntityReply.Merge(m, src)
|
||||
}
|
||||
func (m *GetEntityReply) XXX_Size() int {
|
||||
return xxx_messageInfo_GetEntityReply.Size(m)
|
||||
}
|
||||
func (m *GetEntityReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetEntityReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetEntityReply proto.InternalMessageInfo
|
||||
|
||||
func (m *GetEntityReply) GetEntity() *Entity {
|
||||
if m != nil {
|
||||
return m.Entity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateEntityRequest struct {
|
||||
Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateEntityRequest) Reset() { *m = CreateEntityRequest{} }
|
||||
func (m *CreateEntityRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateEntityRequest) ProtoMessage() {}
|
||||
func (*CreateEntityRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{4}
|
||||
}
|
||||
|
||||
func (m *CreateEntityRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateEntityRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateEntityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateEntityRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *CreateEntityRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateEntityRequest.Merge(m, src)
|
||||
}
|
||||
func (m *CreateEntityRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateEntityRequest.Size(m)
|
||||
}
|
||||
func (m *CreateEntityRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateEntityRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateEntityRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateEntityRequest) GetEntity() *Entity {
|
||||
if m != nil {
|
||||
return m.Entity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateEntityReply struct {
|
||||
Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateEntityReply) Reset() { *m = CreateEntityReply{} }
|
||||
func (m *CreateEntityReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateEntityReply) ProtoMessage() {}
|
||||
func (*CreateEntityReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{5}
|
||||
}
|
||||
|
||||
func (m *CreateEntityReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateEntityReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateEntityReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateEntityReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *CreateEntityReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateEntityReply.Merge(m, src)
|
||||
}
|
||||
func (m *CreateEntityReply) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateEntityReply.Size(m)
|
||||
}
|
||||
func (m *CreateEntityReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateEntityReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateEntityReply proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateEntityReply) GetEntity() *Entity {
|
||||
if m != nil {
|
||||
return m.Entity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SetFactRequest struct {
|
||||
EntityUri string `protobuf:"bytes,1,opt,name=entityUri,proto3" json:"entityUri,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SetFactRequest) Reset() { *m = SetFactRequest{} }
|
||||
func (m *SetFactRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetFactRequest) ProtoMessage() {}
|
||||
func (*SetFactRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{6}
|
||||
}
|
||||
|
||||
func (m *SetFactRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SetFactRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SetFactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SetFactRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *SetFactRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SetFactRequest.Merge(m, src)
|
||||
}
|
||||
func (m *SetFactRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_SetFactRequest.Size(m)
|
||||
}
|
||||
func (m *SetFactRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SetFactRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SetFactRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *SetFactRequest) GetEntityUri() string {
|
||||
if m != nil {
|
||||
return m.EntityUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *SetFactRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *SetFactRequest) GetValue() string {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SetFactReply struct {
|
||||
Fact *Fact `protobuf:"bytes,1,opt,name=fact,proto3" json:"fact,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SetFactReply) Reset() { *m = SetFactReply{} }
|
||||
func (m *SetFactReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetFactReply) ProtoMessage() {}
|
||||
func (*SetFactReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{7}
|
||||
}
|
||||
|
||||
func (m *SetFactReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SetFactReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SetFactReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SetFactReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *SetFactReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SetFactReply.Merge(m, src)
|
||||
}
|
||||
func (m *SetFactReply) XXX_Size() int {
|
||||
return xxx_messageInfo_SetFactReply.Size(m)
|
||||
}
|
||||
func (m *SetFactReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SetFactReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SetFactReply proto.InternalMessageInfo
|
||||
|
||||
func (m *SetFactReply) GetFact() *Fact {
|
||||
if m != nil {
|
||||
return m.Fact
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetFactRequest struct {
|
||||
EntityUri string `protobuf:"bytes,1,opt,name=entityUri,proto3" json:"entityUri,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetFactRequest) Reset() { *m = GetFactRequest{} }
|
||||
func (m *GetFactRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetFactRequest) ProtoMessage() {}
|
||||
func (*GetFactRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{8}
|
||||
}
|
||||
|
||||
func (m *GetFactRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetFactRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetFactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetFactRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetFactRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetFactRequest.Merge(m, src)
|
||||
}
|
||||
func (m *GetFactRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_GetFactRequest.Size(m)
|
||||
}
|
||||
func (m *GetFactRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetFactRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetFactRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *GetFactRequest) GetEntityUri() string {
|
||||
if m != nil {
|
||||
return m.EntityUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *GetFactRequest) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetFactReply struct {
|
||||
Fact *Fact `protobuf:"bytes,1,opt,name=fact,proto3" json:"fact,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetFactReply) Reset() { *m = GetFactReply{} }
|
||||
func (m *GetFactReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetFactReply) ProtoMessage() {}
|
||||
func (*GetFactReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{9}
|
||||
}
|
||||
|
||||
func (m *GetFactReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetFactReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetFactReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetFactReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *GetFactReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetFactReply.Merge(m, src)
|
||||
}
|
||||
func (m *GetFactReply) XXX_Size() int {
|
||||
return xxx_messageInfo_GetFactReply.Size(m)
|
||||
}
|
||||
func (m *GetFactReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetFactReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetFactReply proto.InternalMessageInfo
|
||||
|
||||
func (m *GetFactReply) GetFact() *Fact {
|
||||
if m != nil {
|
||||
return m.Fact
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Entity struct {
|
||||
Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"`
|
||||
Facts []*Fact `protobuf:"bytes,2,rep,name=facts,proto3" json:"facts,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Entity) Reset() { *m = Entity{} }
|
||||
func (m *Entity) String() string { return proto.CompactTextString(m) }
|
||||
func (*Entity) ProtoMessage() {}
|
||||
func (*Entity) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{10}
|
||||
}
|
||||
|
||||
func (m *Entity) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Entity.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Entity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Entity.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Entity) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Entity.Merge(m, src)
|
||||
}
|
||||
func (m *Entity) XXX_Size() int {
|
||||
return xxx_messageInfo_Entity.Size(m)
|
||||
}
|
||||
func (m *Entity) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Entity.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Entity proto.InternalMessageInfo
|
||||
|
||||
func (m *Entity) GetUri() string {
|
||||
if m != nil {
|
||||
return m.Uri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Entity) GetFacts() []*Fact {
|
||||
if m != nil {
|
||||
return m.Facts
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Fact struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Fact) Reset() { *m = Fact{} }
|
||||
func (m *Fact) String() string { return proto.CompactTextString(m) }
|
||||
func (*Fact) ProtoMessage() {}
|
||||
func (*Fact) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_70be9028e322f9d8, []int{11}
|
||||
}
|
||||
|
||||
func (m *Fact) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Fact.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Fact) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Fact.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Fact) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Fact.Merge(m, src)
|
||||
}
|
||||
func (m *Fact) XXX_Size() int {
|
||||
return xxx_messageInfo_Fact.Size(m)
|
||||
}
|
||||
func (m *Fact) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Fact.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Fact proto.InternalMessageInfo
|
||||
|
||||
func (m *Fact) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Fact) GetValue() string {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ListEntitiesRequest)(nil), "spotify.backstage.inventory.v1.ListEntitiesRequest")
|
||||
proto.RegisterType((*ListEntitiesReply)(nil), "spotify.backstage.inventory.v1.ListEntitiesReply")
|
||||
proto.RegisterType((*GetEntityRequest)(nil), "spotify.backstage.inventory.v1.GetEntityRequest")
|
||||
proto.RegisterType((*GetEntityReply)(nil), "spotify.backstage.inventory.v1.GetEntityReply")
|
||||
proto.RegisterType((*CreateEntityRequest)(nil), "spotify.backstage.inventory.v1.CreateEntityRequest")
|
||||
proto.RegisterType((*CreateEntityReply)(nil), "spotify.backstage.inventory.v1.CreateEntityReply")
|
||||
proto.RegisterType((*SetFactRequest)(nil), "spotify.backstage.inventory.v1.SetFactRequest")
|
||||
proto.RegisterType((*SetFactReply)(nil), "spotify.backstage.inventory.v1.SetFactReply")
|
||||
proto.RegisterType((*GetFactRequest)(nil), "spotify.backstage.inventory.v1.GetFactRequest")
|
||||
proto.RegisterType((*GetFactReply)(nil), "spotify.backstage.inventory.v1.GetFactReply")
|
||||
proto.RegisterType((*Entity)(nil), "spotify.backstage.inventory.v1.Entity")
|
||||
proto.RegisterType((*Fact)(nil), "spotify.backstage.inventory.v1.Fact")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("inventory/v1/inventory.proto", fileDescriptor_70be9028e322f9d8) }
|
||||
|
||||
var fileDescriptor_70be9028e322f9d8 = []byte{
|
||||
// 428 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6b, 0xe2, 0x40,
|
||||
0x14, 0x27, 0x1a, 0xdd, 0xcd, 0xd3, 0x15, 0x1d, 0xf7, 0x10, 0x44, 0x16, 0x09, 0xcb, 0xe2, 0x61,
|
||||
0x89, 0x46, 0x2f, 0xcb, 0x1e, 0x7a, 0xb0, 0xb4, 0x69, 0xa1, 0x07, 0x89, 0xd8, 0x96, 0xde, 0xa2,
|
||||
0x8c, 0x32, 0x54, 0x13, 0x9b, 0x4c, 0x42, 0xf3, 0xdd, 0xfa, 0xe1, 0xca, 0x4c, 0xe2, 0x18, 0x5b,
|
||||
0x69, 0x22, 0x7a, 0xcb, 0xbc, 0x37, 0xbf, 0x3f, 0xf3, 0x66, 0x7e, 0x04, 0xda, 0xc4, 0x09, 0xb1,
|
||||
0x43, 0x5d, 0x2f, 0xea, 0x85, 0x46, 0x4f, 0x2c, 0xf4, 0x8d, 0xe7, 0x52, 0x17, 0xfd, 0xf2, 0x37,
|
||||
0x2e, 0x25, 0x8b, 0x48, 0x9f, 0xd9, 0xf3, 0x67, 0x9f, 0xda, 0x4b, 0xac, 0xef, 0xb6, 0x84, 0x86,
|
||||
0x36, 0x84, 0xe6, 0x1d, 0xf1, 0xe9, 0x95, 0x43, 0x09, 0x25, 0xd8, 0xb7, 0xf0, 0x4b, 0x80, 0x7d,
|
||||
0x8a, 0xda, 0xa0, 0x04, 0x1e, 0x19, 0x7b, 0x78, 0x41, 0x5e, 0x55, 0xa9, 0x23, 0x75, 0x15, 0x6b,
|
||||
0x57, 0xd0, 0x1e, 0xa0, 0xb1, 0x0f, 0xda, 0xac, 0x22, 0x34, 0x82, 0xef, 0x38, 0x29, 0xa8, 0x52,
|
||||
0xa7, 0xd8, 0xad, 0x0c, 0xfe, 0xe8, 0x5f, 0x8b, 0xeb, 0x9c, 0x20, 0xb2, 0x04, 0x4e, 0xb3, 0xa0,
|
||||
0x6e, 0x62, 0x9a, 0x94, 0x13, 0x2b, 0x17, 0x50, 0xe6, 0xfd, 0x88, 0xfb, 0xc8, 0xcf, 0x9a, 0xa0,
|
||||
0xb4, 0x31, 0xd4, 0x52, 0x9c, 0xcc, 0xe9, 0xa9, 0x8c, 0x53, 0x68, 0x5e, 0x7a, 0xd8, 0xa6, 0xf8,
|
||||
0xbc, 0x46, 0x27, 0xd0, 0xd8, 0xa7, 0x3d, 0x87, 0xd7, 0x47, 0xa8, 0x4d, 0x30, 0xbd, 0xb6, 0xe7,
|
||||
0x34, 0x75, 0xb5, 0x71, 0x6f, 0xea, 0x91, 0xed, 0xd5, 0x8a, 0x02, 0x42, 0x20, 0x3b, 0xf6, 0x1a,
|
||||
0xab, 0x05, 0xde, 0xe0, 0xdf, 0xe8, 0x27, 0x94, 0x42, 0x7b, 0x15, 0x60, 0xb5, 0xc8, 0x8b, 0xf1,
|
||||
0x42, 0xbb, 0x81, 0xaa, 0x60, 0x66, 0x4e, 0xff, 0x81, 0xbc, 0xb0, 0xe7, 0x34, 0xf1, 0xf9, 0x3b,
|
||||
0xcb, 0x27, 0x07, 0x72, 0x84, 0x36, 0xe2, 0x37, 0x74, 0x92, 0x47, 0xe6, 0xc6, 0x3c, 0x8f, 0x9b,
|
||||
0x7b, 0x28, 0xc7, 0x33, 0x44, 0x75, 0x28, 0x06, 0x42, 0x9f, 0x7d, 0xa2, 0xff, 0x50, 0x62, 0x7b,
|
||||
0x7c, 0xb5, 0xc0, 0x1f, 0x78, 0x3e, 0xda, 0x18, 0xa2, 0xf5, 0x41, 0x66, 0x4b, 0xe1, 0x5e, 0x3a,
|
||||
0x34, 0xe1, 0x42, 0x6a, 0xc2, 0x83, 0x37, 0x19, 0x94, 0xdb, 0x2d, 0x1d, 0x0a, 0xa1, 0x9a, 0x0e,
|
||||
0x1d, 0x1a, 0x66, 0x89, 0x1f, 0xc8, 0x75, 0xcb, 0x38, 0x0e, 0xc4, 0x26, 0xb9, 0x06, 0x45, 0xe4,
|
||||
0x07, 0xf5, 0xb3, 0xf0, 0x1f, 0xe3, 0xdb, 0xd2, 0x8f, 0x40, 0x30, 0xb9, 0x10, 0xaa, 0xe9, 0x14,
|
||||
0x64, 0x1f, 0xf3, 0x40, 0x14, 0xb3, 0x8f, 0xf9, 0x39, 0x68, 0x4b, 0xf8, 0x96, 0x3c, 0x67, 0x94,
|
||||
0x69, 0x79, 0x3f, 0x51, 0xad, 0xbf, 0xb9, 0xf7, 0x27, 0x42, 0x66, 0x5e, 0x21, 0xf3, 0x48, 0xa1,
|
||||
0x74, 0x04, 0x46, 0x3f, 0x9e, 0x2a, 0xa2, 0x19, 0x1a, 0xb3, 0x32, 0xff, 0x21, 0x0c, 0xdf, 0x03,
|
||||
0x00, 0x00, 0xff, 0xff, 0xce, 0x45, 0x7f, 0xc5, 0x30, 0x06, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// InventoryClient is the client API for Inventory service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type InventoryClient interface {
|
||||
ListEntities(ctx context.Context, in *ListEntitiesRequest, opts ...grpc.CallOption) (*ListEntitiesReply, error)
|
||||
GetEntity(ctx context.Context, in *GetEntityRequest, opts ...grpc.CallOption) (*GetEntityReply, error)
|
||||
CreateEntity(ctx context.Context, in *CreateEntityRequest, opts ...grpc.CallOption) (*CreateEntityReply, error)
|
||||
SetFact(ctx context.Context, in *SetFactRequest, opts ...grpc.CallOption) (*SetFactReply, error)
|
||||
GetFact(ctx context.Context, in *GetFactRequest, opts ...grpc.CallOption) (*GetFactReply, error)
|
||||
}
|
||||
|
||||
type inventoryClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewInventoryClient(cc grpc.ClientConnInterface) InventoryClient {
|
||||
return &inventoryClient{cc}
|
||||
}
|
||||
|
||||
func (c *inventoryClient) ListEntities(ctx context.Context, in *ListEntitiesRequest, opts ...grpc.CallOption) (*ListEntitiesReply, error) {
|
||||
out := new(ListEntitiesReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/ListEntities", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *inventoryClient) GetEntity(ctx context.Context, in *GetEntityRequest, opts ...grpc.CallOption) (*GetEntityReply, error) {
|
||||
out := new(GetEntityReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/GetEntity", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *inventoryClient) CreateEntity(ctx context.Context, in *CreateEntityRequest, opts ...grpc.CallOption) (*CreateEntityReply, error) {
|
||||
out := new(CreateEntityReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/CreateEntity", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *inventoryClient) SetFact(ctx context.Context, in *SetFactRequest, opts ...grpc.CallOption) (*SetFactReply, error) {
|
||||
out := new(SetFactReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/SetFact", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *inventoryClient) GetFact(ctx context.Context, in *GetFactRequest, opts ...grpc.CallOption) (*GetFactReply, error) {
|
||||
out := new(GetFactReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/GetFact", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// InventoryServer is the server API for Inventory service.
|
||||
type InventoryServer interface {
|
||||
ListEntities(context.Context, *ListEntitiesRequest) (*ListEntitiesReply, error)
|
||||
GetEntity(context.Context, *GetEntityRequest) (*GetEntityReply, error)
|
||||
CreateEntity(context.Context, *CreateEntityRequest) (*CreateEntityReply, error)
|
||||
SetFact(context.Context, *SetFactRequest) (*SetFactReply, error)
|
||||
GetFact(context.Context, *GetFactRequest) (*GetFactReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedInventoryServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedInventoryServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedInventoryServer) ListEntities(ctx context.Context, req *ListEntitiesRequest) (*ListEntitiesReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListEntities not implemented")
|
||||
}
|
||||
func (*UnimplementedInventoryServer) GetEntity(ctx context.Context, req *GetEntityRequest) (*GetEntityReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetEntity not implemented")
|
||||
}
|
||||
func (*UnimplementedInventoryServer) CreateEntity(ctx context.Context, req *CreateEntityRequest) (*CreateEntityReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateEntity not implemented")
|
||||
}
|
||||
func (*UnimplementedInventoryServer) SetFact(ctx context.Context, req *SetFactRequest) (*SetFactReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetFact not implemented")
|
||||
}
|
||||
func (*UnimplementedInventoryServer) GetFact(ctx context.Context, req *GetFactRequest) (*GetFactReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetFact not implemented")
|
||||
}
|
||||
|
||||
func RegisterInventoryServer(s *grpc.Server, srv InventoryServer) {
|
||||
s.RegisterService(&_Inventory_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Inventory_ListEntities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListEntitiesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(InventoryServer).ListEntities(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.inventory.v1.Inventory/ListEntities",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(InventoryServer).ListEntities(ctx, req.(*ListEntitiesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Inventory_GetEntity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetEntityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(InventoryServer).GetEntity(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.inventory.v1.Inventory/GetEntity",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(InventoryServer).GetEntity(ctx, req.(*GetEntityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Inventory_CreateEntity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateEntityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(InventoryServer).CreateEntity(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.inventory.v1.Inventory/CreateEntity",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(InventoryServer).CreateEntity(ctx, req.(*CreateEntityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Inventory_SetFact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetFactRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(InventoryServer).SetFact(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.inventory.v1.Inventory/SetFact",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(InventoryServer).SetFact(ctx, req.(*SetFactRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Inventory_GetFact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetFactRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(InventoryServer).GetFact(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.inventory.v1.Inventory/GetFact",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(InventoryServer).GetFact(ctx, req.(*GetFactRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Inventory_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "spotify.backstage.inventory.v1.Inventory",
|
||||
HandlerType: (*InventoryServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListEntities",
|
||||
Handler: _Inventory_ListEntities_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetEntity",
|
||||
Handler: _Inventory_GetEntity_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateEntity",
|
||||
Handler: _Inventory_CreateEntity_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetFact",
|
||||
Handler: _Inventory_SetFact_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetFact",
|
||||
Handler: _Inventory_GetFact_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "inventory/v1/inventory.proto",
|
||||
}
|
||||
@@ -1,429 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: scaffolder/v1/scaffolder.proto
|
||||
|
||||
package scaffolderv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_struct "github.com/golang/protobuf/ptypes/struct"
|
||||
v1 "github.com/spotify/backstage/backend/proto/identity/v1"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Empty struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6737326b433dc57d, []int{0}
|
||||
}
|
||||
|
||||
func (m *Empty) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Empty.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Empty) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Empty.Merge(m, src)
|
||||
}
|
||||
func (m *Empty) XXX_Size() int {
|
||||
return xxx_messageInfo_Empty.Size(m)
|
||||
}
|
||||
func (m *Empty) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Empty.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Empty proto.InternalMessageInfo
|
||||
|
||||
type ListTemplatesReply struct {
|
||||
Templates []*Template `protobuf:"bytes,1,rep,name=templates,proto3" json:"templates,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListTemplatesReply) Reset() { *m = ListTemplatesReply{} }
|
||||
func (m *ListTemplatesReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListTemplatesReply) ProtoMessage() {}
|
||||
func (*ListTemplatesReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6737326b433dc57d, []int{1}
|
||||
}
|
||||
|
||||
func (m *ListTemplatesReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListTemplatesReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListTemplatesReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListTemplatesReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListTemplatesReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListTemplatesReply.Merge(m, src)
|
||||
}
|
||||
func (m *ListTemplatesReply) XXX_Size() int {
|
||||
return xxx_messageInfo_ListTemplatesReply.Size(m)
|
||||
}
|
||||
func (m *ListTemplatesReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListTemplatesReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListTemplatesReply proto.InternalMessageInfo
|
||||
|
||||
func (m *ListTemplatesReply) GetTemplates() []*Template {
|
||||
if m != nil {
|
||||
return m.Templates
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateReply struct {
|
||||
ComponentId string `protobuf:"bytes,1,opt,name=component_id,json=componentId,proto3" json:"component_id,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateReply) Reset() { *m = CreateReply{} }
|
||||
func (m *CreateReply) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateReply) ProtoMessage() {}
|
||||
func (*CreateReply) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6737326b433dc57d, []int{2}
|
||||
}
|
||||
|
||||
func (m *CreateReply) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateReply.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateReply.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *CreateReply) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateReply.Merge(m, src)
|
||||
}
|
||||
func (m *CreateReply) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateReply.Size(m)
|
||||
}
|
||||
func (m *CreateReply) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateReply.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateReply proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateReply) GetComponentId() string {
|
||||
if m != nil {
|
||||
return m.ComponentId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
TemplateId string `protobuf:"bytes,1,opt,name=template_id,json=templateId,proto3" json:"template_id,omitempty"`
|
||||
Org string `protobuf:"bytes,2,opt,name=org,proto3" json:"org,omitempty"`
|
||||
ComponentId string `protobuf:"bytes,3,opt,name=component_id,json=componentId,proto3" json:"component_id,omitempty"`
|
||||
Private bool `protobuf:"varint,4,opt,name=private,proto3" json:"private,omitempty"`
|
||||
// here's the cookiecutter.json that is used for the request.
|
||||
// make as a struct so that we can pass through the data in a nice way
|
||||
// withouth having to mess around with stuff and special types.
|
||||
Metadata *_struct.Struct `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *CreateRequest) Reset() { *m = CreateRequest{} }
|
||||
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateRequest) ProtoMessage() {}
|
||||
func (*CreateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6737326b433dc57d, []int{3}
|
||||
}
|
||||
|
||||
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_CreateRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *CreateRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_CreateRequest.Merge(m, src)
|
||||
}
|
||||
func (m *CreateRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_CreateRequest.Size(m)
|
||||
}
|
||||
func (m *CreateRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_CreateRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_CreateRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *CreateRequest) GetTemplateId() string {
|
||||
if m != nil {
|
||||
return m.TemplateId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateRequest) GetOrg() string {
|
||||
if m != nil {
|
||||
return m.Org
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateRequest) GetComponentId() string {
|
||||
if m != nil {
|
||||
return m.ComponentId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *CreateRequest) GetPrivate() bool {
|
||||
if m != nil {
|
||||
return m.Private
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *CreateRequest) GetMetadata() *_struct.Struct {
|
||||
if m != nil {
|
||||
return m.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Template struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
User *v1.User `protobuf:"bytes,4,opt,name=user,proto3" json:"user,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Template) Reset() { *m = Template{} }
|
||||
func (m *Template) String() string { return proto.CompactTextString(m) }
|
||||
func (*Template) ProtoMessage() {}
|
||||
func (*Template) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6737326b433dc57d, []int{4}
|
||||
}
|
||||
|
||||
func (m *Template) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Template.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Template) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Template.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Template) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Template.Merge(m, src)
|
||||
}
|
||||
func (m *Template) XXX_Size() int {
|
||||
return xxx_messageInfo_Template.Size(m)
|
||||
}
|
||||
func (m *Template) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Template.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Template proto.InternalMessageInfo
|
||||
|
||||
func (m *Template) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Template) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Template) GetDescription() string {
|
||||
if m != nil {
|
||||
return m.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Template) GetUser() *v1.User {
|
||||
if m != nil {
|
||||
return m.User
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Empty)(nil), "spotify.backstage.scaffolder.v1.Empty")
|
||||
proto.RegisterType((*ListTemplatesReply)(nil), "spotify.backstage.scaffolder.v1.ListTemplatesReply")
|
||||
proto.RegisterType((*CreateReply)(nil), "spotify.backstage.scaffolder.v1.CreateReply")
|
||||
proto.RegisterType((*CreateRequest)(nil), "spotify.backstage.scaffolder.v1.CreateRequest")
|
||||
proto.RegisterType((*Template)(nil), "spotify.backstage.scaffolder.v1.Template")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("scaffolder/v1/scaffolder.proto", fileDescriptor_6737326b433dc57d) }
|
||||
|
||||
var fileDescriptor_6737326b433dc57d = []byte{
|
||||
// 411 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xd1, 0x8a, 0xd3, 0x40,
|
||||
0x14, 0x25, 0x6d, 0x77, 0xb7, 0x7b, 0xb3, 0xbb, 0xc8, 0xbc, 0x18, 0x82, 0xb8, 0x31, 0x82, 0x54,
|
||||
0x90, 0xa9, 0x6d, 0x1f, 0x7c, 0x57, 0x44, 0x16, 0x7c, 0xca, 0xea, 0x8b, 0x20, 0x32, 0x4d, 0x6e,
|
||||
0xca, 0x60, 0x92, 0x19, 0x67, 0x6e, 0x03, 0xf9, 0x04, 0xff, 0xc7, 0x2f, 0xf2, 0x4b, 0xa4, 0x53,
|
||||
0x27, 0xdd, 0x65, 0x0b, 0xd9, 0xb7, 0x7b, 0xcf, 0xbd, 0xe7, 0xce, 0xe1, 0x9c, 0x81, 0xe7, 0x36,
|
||||
0x17, 0x65, 0xa9, 0xaa, 0x02, 0xcd, 0xbc, 0x5d, 0xcc, 0x0f, 0x1d, 0xd7, 0x46, 0x91, 0x62, 0xd7,
|
||||
0x56, 0x2b, 0x92, 0x65, 0xc7, 0xd7, 0x22, 0xff, 0x69, 0x49, 0x6c, 0x90, 0xdf, 0xd9, 0x69, 0x17,
|
||||
0x71, 0x2c, 0x0b, 0x6c, 0x48, 0x52, 0xb7, 0xa3, 0xfb, 0x7a, 0x4f, 0x8e, 0x9f, 0x6d, 0x94, 0xda,
|
||||
0x54, 0x38, 0x77, 0xdd, 0x7a, 0x5b, 0xce, 0x2d, 0x99, 0x6d, 0x4e, 0xfb, 0x69, 0x7a, 0x06, 0x27,
|
||||
0x1f, 0x6b, 0x4d, 0x5d, 0xfa, 0x1d, 0xd8, 0x67, 0x69, 0xe9, 0x0b, 0xd6, 0xba, 0x12, 0x84, 0x36,
|
||||
0x43, 0x5d, 0x75, 0xec, 0x13, 0x9c, 0x93, 0x47, 0xa2, 0x20, 0x19, 0xcf, 0xc2, 0xe5, 0x6b, 0x3e,
|
||||
0xa0, 0x86, 0xfb, 0x1b, 0xd9, 0x81, 0x9b, 0xbe, 0x85, 0xf0, 0x83, 0xc1, 0x1d, 0xe8, 0xee, 0xbe,
|
||||
0x80, 0x8b, 0x5c, 0xd5, 0x5a, 0x35, 0xd8, 0xd0, 0x0f, 0x59, 0x44, 0x41, 0x12, 0xcc, 0xce, 0xb3,
|
||||
0xb0, 0xc7, 0x6e, 0x8a, 0xf4, 0x4f, 0x00, 0x97, 0x9e, 0xf2, 0x6b, 0x8b, 0x96, 0xd8, 0x35, 0x84,
|
||||
0xfe, 0xe0, 0x81, 0x03, 0x1e, 0xba, 0x29, 0xd8, 0x13, 0x18, 0x2b, 0xb3, 0x89, 0x46, 0x6e, 0xb0,
|
||||
0x2b, 0x1f, 0xbc, 0x33, 0x7e, 0xf0, 0x0e, 0x8b, 0xe0, 0x4c, 0x1b, 0xd9, 0x0a, 0xc2, 0x68, 0x92,
|
||||
0x04, 0xb3, 0x69, 0xe6, 0x5b, 0xb6, 0x82, 0x69, 0x8d, 0x24, 0x0a, 0x41, 0x22, 0x3a, 0x49, 0x82,
|
||||
0x59, 0xb8, 0x7c, 0xca, 0xf7, 0x66, 0x72, 0x6f, 0x26, 0xbf, 0x75, 0x66, 0x66, 0xfd, 0x62, 0xfa,
|
||||
0x3b, 0x80, 0xa9, 0x37, 0x80, 0x5d, 0xc1, 0xa8, 0x17, 0x3a, 0x92, 0x05, 0x63, 0x30, 0x69, 0x44,
|
||||
0x8d, 0xff, 0x15, 0xba, 0x9a, 0x25, 0x10, 0x16, 0x68, 0x73, 0x23, 0x35, 0x49, 0xd5, 0x78, 0x85,
|
||||
0x77, 0x20, 0xf6, 0x0e, 0x26, 0x5b, 0x8b, 0xc6, 0xc9, 0x0b, 0x97, 0x2f, 0x8f, 0xf8, 0xdf, 0x47,
|
||||
0xde, 0x2e, 0xf8, 0x57, 0x8b, 0x26, 0x73, 0x84, 0xe5, 0xdf, 0x00, 0xe0, 0xb6, 0x8f, 0x86, 0x55,
|
||||
0x70, 0x79, 0x2f, 0x62, 0xf6, 0x6a, 0x30, 0x4a, 0xf7, 0x37, 0xe2, 0xd5, 0xe0, 0xde, 0x91, 0xaf,
|
||||
0x53, 0xc2, 0xe9, 0x3e, 0x3e, 0xc6, 0x07, 0xe9, 0xf7, 0x72, 0x8e, 0xdf, 0x3c, 0x7a, 0x5f, 0x57,
|
||||
0xdd, 0xfb, 0xab, 0x6f, 0x17, 0x87, 0x61, 0xbb, 0x58, 0x9f, 0xba, 0x6c, 0x56, 0xff, 0x02, 0x00,
|
||||
0x00, 0xff, 0xff, 0xfc, 0x1f, 0xfc, 0xf0, 0x55, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// ScaffolderClient is the client API for Scaffolder service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type ScaffolderClient interface {
|
||||
ListTemplates(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListTemplatesReply, error)
|
||||
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateReply, error)
|
||||
}
|
||||
|
||||
type scaffolderClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewScaffolderClient(cc grpc.ClientConnInterface) ScaffolderClient {
|
||||
return &scaffolderClient{cc}
|
||||
}
|
||||
|
||||
func (c *scaffolderClient) ListTemplates(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListTemplatesReply, error) {
|
||||
out := new(ListTemplatesReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.scaffolder.v1.Scaffolder/ListTemplates", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *scaffolderClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateReply, error) {
|
||||
out := new(CreateReply)
|
||||
err := c.cc.Invoke(ctx, "/spotify.backstage.scaffolder.v1.Scaffolder/Create", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ScaffolderServer is the server API for Scaffolder service.
|
||||
type ScaffolderServer interface {
|
||||
ListTemplates(context.Context, *Empty) (*ListTemplatesReply, error)
|
||||
Create(context.Context, *CreateRequest) (*CreateReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedScaffolderServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedScaffolderServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedScaffolderServer) ListTemplates(ctx context.Context, req *Empty) (*ListTemplatesReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListTemplates not implemented")
|
||||
}
|
||||
func (*UnimplementedScaffolderServer) Create(ctx context.Context, req *CreateRequest) (*CreateReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
|
||||
func RegisterScaffolderServer(s *grpc.Server, srv ScaffolderServer) {
|
||||
s.RegisterService(&_Scaffolder_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Scaffolder_ListTemplates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ScaffolderServer).ListTemplates(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.scaffolder.v1.Scaffolder/ListTemplates",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ScaffolderServer).ListTemplates(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Scaffolder_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ScaffolderServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/spotify.backstage.scaffolder.v1.Scaffolder/Create",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ScaffolderServer).Create(ctx, req.(*CreateRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Scaffolder_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "spotify.backstage.scaffolder.v1.Scaffolder",
|
||||
HandlerType: (*ScaffolderServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListTemplates",
|
||||
Handler: _Scaffolder_ListTemplates_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Create",
|
||||
Handler: _Scaffolder_Create_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "scaffolder/v1/scaffolder.proto",
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM envoyproxy/envoy:v1.13.0
|
||||
|
||||
COPY ./envoy.yaml /etc/envoy/envoy.yaml
|
||||
|
||||
CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml
|
||||
@@ -1,91 +0,0 @@
|
||||
admin:
|
||||
access_log_path: /dev/stdout
|
||||
address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 8001
|
||||
|
||||
static_resources:
|
||||
listeners:
|
||||
- name: listener_0
|
||||
address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 80
|
||||
filter_chains:
|
||||
- filters:
|
||||
- name: envoy.http_connection_manager
|
||||
config:
|
||||
codec_type: auto
|
||||
stat_prefix: ingress_http
|
||||
route_config:
|
||||
name: local_route
|
||||
virtual_hosts:
|
||||
- name: local_service
|
||||
domains: ['*']
|
||||
routes:
|
||||
- match: { prefix: '/spotify.backstage.identity.v1.Identity/' }
|
||||
route:
|
||||
cluster: identity_service
|
||||
max_grpc_timeout: 0s
|
||||
- match: { prefix: '/spotify.backstage.builds.v1.Builds/' }
|
||||
route:
|
||||
cluster: builds_service
|
||||
max_grpc_timeout: 0s
|
||||
- match: { prefix: '/spotify.backstage.inventory.v1.Inventory/' }
|
||||
route:
|
||||
cluster: inventory_service
|
||||
max_grpc_timeout: 0s
|
||||
- match: { prefix: '/spotify.backstage.scaffolder.v1.Scaffolder/' }
|
||||
route:
|
||||
cluster: scaffolder_service
|
||||
max_grpc_timeout: 0s
|
||||
cors:
|
||||
allow_origin_string_match:
|
||||
- prefix: '*'
|
||||
allow_methods: GET, PUT, DELETE, POST, OPTIONS
|
||||
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
|
||||
max_age: '1728000'
|
||||
expose_headers: custom-header-1,grpc-status,grpc-message
|
||||
http_filters:
|
||||
- name: envoy.grpc_web
|
||||
- name: envoy.cors
|
||||
- name: envoy.router
|
||||
|
||||
clusters:
|
||||
- name: identity_service
|
||||
connect_timeout: 0.25s
|
||||
type: logical_dns
|
||||
http2_protocol_options: {}
|
||||
lb_policy: round_robin
|
||||
hosts:
|
||||
- socket_address:
|
||||
address: identity
|
||||
port_value: 50051
|
||||
- name: builds_service
|
||||
connect_timeout: 0.25s
|
||||
type: logical_dns
|
||||
http2_protocol_options: {}
|
||||
lb_policy: round_robin
|
||||
hosts:
|
||||
- socket_address:
|
||||
address: builds
|
||||
port_value: 50051
|
||||
- name: inventory_service
|
||||
connect_timeout: 0.25s
|
||||
type: logical_dns
|
||||
http2_protocol_options: {}
|
||||
lb_policy: round_robin
|
||||
hosts:
|
||||
- socket_address:
|
||||
address: inventory
|
||||
port_value: 50051
|
||||
- name: scaffolder_service
|
||||
connect_timeout: 0.25s
|
||||
type: logical_dns
|
||||
http2_protocol_options: {}
|
||||
lb_policy: round_robin
|
||||
hosts:
|
||||
- socket_address:
|
||||
address: scaffolder
|
||||
port_value: 50051
|
||||
@@ -1,160 +0,0 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
identity "github.com/spotify/backstage/backend/proto/identity/v1"
|
||||
inventory "github.com/spotify/backstage/backend/proto/inventory/v1"
|
||||
pb "github.com/spotify/backstage/backend/proto/scaffolder/v1"
|
||||
"github.com/spotify/backstage/scaffolder/fs"
|
||||
"github.com/spotify/backstage/scaffolder/lib"
|
||||
"github.com/spotify/backstage/scaffolder/repository"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Server is the inventory Grpc server
|
||||
type Server struct {
|
||||
repository *repository.Repository
|
||||
github *lib.Github
|
||||
fs *fs.Filesystem
|
||||
cookie *lib.Cutter
|
||||
git *lib.Git
|
||||
inventory inventory.InventoryClient
|
||||
}
|
||||
|
||||
// NewServer creates a new server for with all the things
|
||||
func NewServer() *Server {
|
||||
conn, err := grpc.Dial("inventory:50051", grpc.WithInsecure())
|
||||
|
||||
if err != nil {
|
||||
log.Fatal("Cannot connect to inventory service")
|
||||
}
|
||||
|
||||
return &Server{
|
||||
github: lib.NewGithubClient(),
|
||||
inventory: inventory.NewInventoryClient(conn),
|
||||
}
|
||||
}
|
||||
|
||||
// Create scaffolds the repo in github and then will create push to the repository
|
||||
func (s *Server) Create(ctx context.Context, req *pb.CreateRequest) (*pb.CreateReply, error) {
|
||||
// first create the repository with github
|
||||
log.Printf("Creating repository for Component %s", req.ComponentId)
|
||||
repo := lib.Repository{
|
||||
Name: req.ComponentId,
|
||||
Org: req.Org,
|
||||
Private: req.Private,
|
||||
}
|
||||
|
||||
if _, err := s.github.CreateRepository(repo); err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("Could not create repository %s/%s %s", req.Org, req.ComponentId, err))
|
||||
}
|
||||
|
||||
// move the template into a temporary directory
|
||||
tempFolder, err := s.fs.PrepareTemplate(
|
||||
fs.Template{
|
||||
ID: req.TemplateId,
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("Could not prepare the template %s", err))
|
||||
}
|
||||
|
||||
// get the optional metadatafields from the json
|
||||
marshaler := &jsonpb.Marshaler{}
|
||||
cutterMetadata, err := marshaler.MarshalToString(req.Metadata)
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("Could not marshal the cookiecutter metadata %s", err))
|
||||
}
|
||||
|
||||
cookieTemplate := lib.CookieCutterTemplate{
|
||||
Path: tempFolder,
|
||||
ComponentID: req.ComponentId,
|
||||
Metadata: cutterMetadata,
|
||||
}
|
||||
|
||||
// create the cookicutter json
|
||||
if err := s.cookie.WriteMetadata(cookieTemplate); err != nil {
|
||||
return nil, status.Error(codes.Internal, "Could not write cookie metadata")
|
||||
}
|
||||
|
||||
// run the cookiecutter on the folder
|
||||
if err := s.cookie.Run(cookieTemplate); err != nil {
|
||||
return nil, status.Error(codes.Internal, "Failed to run the cookie cutter")
|
||||
}
|
||||
|
||||
// push to github
|
||||
pushOptions := lib.PushRepositoryOptions{
|
||||
TempFolder: tempFolder,
|
||||
ComponentID: req.ComponentId,
|
||||
Org: req.Org,
|
||||
}
|
||||
|
||||
if err := s.git.Push(pushOptions); err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("Failed to push the repository to Github %s", err))
|
||||
}
|
||||
|
||||
// notify the inventory service
|
||||
_, err = s.inventory.CreateEntity(ctx, &inventory.CreateEntityRequest{
|
||||
Entity: &inventory.Entity{
|
||||
Uri: fmt.Sprintf("entity:service:%s", req.ComponentId),
|
||||
Facts: []*inventory.Fact{
|
||||
{
|
||||
Name: "githubOwner",
|
||||
Value: os.Getenv("BOSS_GH_USERNAME"),
|
||||
},
|
||||
{
|
||||
Name: "githubRepo",
|
||||
Value: req.ComponentId,
|
||||
},
|
||||
{
|
||||
Name: "backstageTemplate",
|
||||
Value: req.TemplateId,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, fmt.Sprintf("Failed to register the entity in the inventory %s", err))
|
||||
}
|
||||
|
||||
return &pb.CreateReply{
|
||||
ComponentId: req.ComponentId,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ListTemplates returns the local templatess
|
||||
func (s *Server) ListTemplates(ctx context.Context, req *pb.Empty) (*pb.ListTemplatesReply, error) {
|
||||
// TODO(blam): yes we currently read the disk on every load. but it's fine for now 🤷♂️
|
||||
definitions, err := s.repository.Load()
|
||||
var templates []*pb.Template
|
||||
|
||||
for _, definition := range definitions {
|
||||
template := &pb.Template{
|
||||
Id: definition.ID,
|
||||
Name: definition.Name,
|
||||
Description: definition.Description,
|
||||
|
||||
// need to actually call the idenity service here to get the
|
||||
// actual user and propgate back when needed.
|
||||
User: &identity.User{
|
||||
Id: "spotify",
|
||||
Name: "Spotify",
|
||||
},
|
||||
}
|
||||
|
||||
templates = append(templates, template)
|
||||
}
|
||||
|
||||
return &pb.ListTemplatesReply{
|
||||
Templates: templates,
|
||||
}, err
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSample(t *testing.T) {
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// Filesystem Repository
|
||||
type Filesystem struct {
|
||||
}
|
||||
|
||||
func file(src, dst string) error {
|
||||
var err error
|
||||
var srcfd *os.File
|
||||
var dstfd *os.File
|
||||
var srcinfo os.FileInfo
|
||||
|
||||
if srcfd, err = os.Open(src); err != nil {
|
||||
return err
|
||||
}
|
||||
defer srcfd.Close()
|
||||
|
||||
if dstfd, err = os.Create(dst); err != nil {
|
||||
return err
|
||||
}
|
||||
defer dstfd.Close()
|
||||
|
||||
if _, err = io.Copy(dstfd, srcfd); err != nil {
|
||||
return err
|
||||
}
|
||||
if srcinfo, err = os.Stat(src); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Chmod(dst, srcinfo.Mode())
|
||||
}
|
||||
|
||||
func dir(src string, dst string) error {
|
||||
var err error
|
||||
var fds []os.FileInfo
|
||||
var srcinfo os.FileInfo
|
||||
|
||||
if srcinfo, err = os.Stat(src); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = os.MkdirAll(dst, srcinfo.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if fds, err = ioutil.ReadDir(src); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, fd := range fds {
|
||||
srcfp := path.Join(src, fd.Name())
|
||||
dstfp := path.Join(dst, fd.Name())
|
||||
|
||||
if fd.IsDir() {
|
||||
if err = dir(srcfp, dstfp); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
} else {
|
||||
if err = file(srcfp, dstfp); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Template holds the template ID for copying
|
||||
type Template struct {
|
||||
ID string
|
||||
}
|
||||
|
||||
// PrepareTemplate will copy the local template to temp folder
|
||||
// and return the temp location
|
||||
func (f *Filesystem) PrepareTemplate(template Template) (string, error) {
|
||||
tempDirectory, _ := ioutil.TempDir(os.TempDir(), template.ID)
|
||||
if err := dir("./templates/"+template.ID, tempDirectory); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return tempDirectory, nil
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
module github.com/spotify/backstage/scaffolder
|
||||
|
||||
go 1.13
|
||||
|
||||
replace (
|
||||
github.com/spotify/backstage/backend/proto => ./../proto
|
||||
github.com/spotify/backstage/proto => ../proto
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.3.3
|
||||
github.com/google/go-github/v29 v29.0.2
|
||||
github.com/spotify/backstage/backend/proto v0.0.0-00010101000000-000000000000
|
||||
github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
|
||||
google.golang.org/grpc v1.27.0
|
||||
gopkg.in/src-d/go-git.v4 v4.13.1
|
||||
)
|
||||
@@ -1,115 +0,0 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
|
||||
github.com/google/go-github/v29 v29.0.2 h1:opYN6Wc7DOz7Ku3Oh4l7prmkOMwEcQxpFtxdU8N8Pts=
|
||||
github.com/google/go-github/v29 v29.0.2/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4=
|
||||
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
|
||||
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
|
||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e h1:D5TXcfTk7xF7hvieo4QErS3qqCB4teTffacDWr7CI+0=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg=
|
||||
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
|
||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
|
||||
gopkg.in/src-d/go-git.v4 v4.13.1 h1:SRtFyV8Kxc0UP7aCHcijOMQGPxHSmMOPrzulQWolkYE=
|
||||
gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8=
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@@ -1,62 +0,0 @@
|
||||
package lib
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// Cutter is the wrapper around cookiecutter
|
||||
type Cutter struct {
|
||||
}
|
||||
|
||||
// CookieCutterTemplate holds the template ID and metadata for copying
|
||||
type CookieCutterTemplate struct {
|
||||
Path string
|
||||
Metadata string
|
||||
ComponentID string
|
||||
}
|
||||
|
||||
// WriteMetadata runs cookiecutter in the folder provided
|
||||
func (c *Cutter) WriteMetadata(template CookieCutterTemplate) error {
|
||||
var temporaryCookieCutter map[string]interface{}
|
||||
err := json.Unmarshal([]byte(template.Metadata), &temporaryCookieCutter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
temporaryCookieCutter["component_id"] = template.ComponentID
|
||||
temporaryCookieCutter["_copy_without_render"] = []string{".github/workflows/*"}
|
||||
finalMetadata, _ := json.Marshal(temporaryCookieCutter)
|
||||
|
||||
file, err := os.Create(fmt.Sprintf("%s/cookiecutter.json", template.Path))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer file.Close()
|
||||
|
||||
_, err = file.Write(finalMetadata)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Run will run the cookie cutter
|
||||
func (c *Cutter) Run(template CookieCutterTemplate) error {
|
||||
// TODO(blam): Probably need to wrap this in a timeout or something to avoid waiting to long
|
||||
log.Printf("Running cookiecutter on %s", template.Path)
|
||||
log.Printf("With metadata %s", template.Metadata)
|
||||
|
||||
cmd := exec.Command("cookiecutter", "--no-input", "-v", template.Path)
|
||||
cmd.Dir = template.Path
|
||||
output, err := cmd.Output()
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Cookie cutter failed with output: %s", output)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package lib
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gopkg.in/src-d/go-git.v4"
|
||||
"gopkg.in/src-d/go-git.v4/config"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/object"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Git is the wrapper around Git
|
||||
type Git struct{}
|
||||
|
||||
// PushRepositoryOptions holds the arguments for the push
|
||||
type PushRepositoryOptions struct {
|
||||
TempFolder string
|
||||
ComponentID string
|
||||
Org string
|
||||
}
|
||||
|
||||
// Push will push the repository to github
|
||||
func (g *Git) Push(options PushRepositoryOptions) error {
|
||||
// use git bindings to add the remote with access token and push to the directory
|
||||
repo, err := git.PlainInit(
|
||||
fmt.Sprintf("%s/%s", options.TempFolder, options.ComponentID),
|
||||
false,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Failed to init the git repository")
|
||||
return err
|
||||
}
|
||||
|
||||
worktree, err := repo.Worktree()
|
||||
if err != nil {
|
||||
log.Printf("Failed to create the worktree")
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = worktree.Add(".")
|
||||
if err != nil {
|
||||
log.Printf("Failed to add the files to the worktre")
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = worktree.Commit("Initial Commit", &git.CommitOptions{
|
||||
Author: &object.Signature{
|
||||
Name: "Backstage",
|
||||
Email: "backstage@spotfy.com",
|
||||
When: time.Now(),
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Failed to create the initial commit")
|
||||
return err
|
||||
}
|
||||
|
||||
var org string = os.Getenv("BOSS_GH_USERNAME")
|
||||
if options.Org != "" {
|
||||
org = options.Org
|
||||
}
|
||||
|
||||
remote := fmt.Sprintf(
|
||||
"https://%s:%s@github.com/%s/%s.git",
|
||||
os.Getenv("BOSS_GH_USERNAME"),
|
||||
os.Getenv("BOSS_GH_ACCESS_TOKEN"),
|
||||
org,
|
||||
options.ComponentID,
|
||||
)
|
||||
|
||||
_, err = repo.CreateRemote(&config.RemoteConfig{
|
||||
Name: "github",
|
||||
URLs: []string{remote},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Failed to create the remote")
|
||||
return err
|
||||
}
|
||||
|
||||
err = repo.Push(&git.PushOptions{
|
||||
RemoteName: "github",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Failled to push the repository")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package lib
|
||||
|
||||
import (
|
||||
"context"
|
||||
gh "github.com/google/go-github/v29/github"
|
||||
"golang.org/x/oauth2"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Github is the exported struct
|
||||
type Github struct {
|
||||
client *gh.Client
|
||||
ctx *context.Context
|
||||
}
|
||||
|
||||
// NewGithubClient returns a new client with the correct access token enabled
|
||||
func NewGithubClient() *Github {
|
||||
accessToken := os.Getenv("BOSS_GH_ACCESS_TOKEN")
|
||||
|
||||
if accessToken == "" {
|
||||
log.Fatal("No BOSS_GH_ACCESS_TOKEN set. Cannot continue")
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
ts := oauth2.StaticTokenSource(
|
||||
&oauth2.Token{AccessToken: accessToken},
|
||||
)
|
||||
tc := oauth2.NewClient(ctx, ts)
|
||||
client := gh.NewClient(tc)
|
||||
|
||||
return &Github{
|
||||
client: client,
|
||||
ctx: &ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Repository holds the information of the created repo
|
||||
type Repository struct {
|
||||
Org string
|
||||
Name string
|
||||
Private bool
|
||||
}
|
||||
|
||||
// CreateRepository will create the repository in Github ready for use by the scaffolder
|
||||
func (g *Github) CreateRepository(repo Repository) (*gh.Repository, error) {
|
||||
ghRepo := &gh.Repository{
|
||||
Name: &repo.Name,
|
||||
Private: &repo.Private,
|
||||
}
|
||||
|
||||
var org string
|
||||
|
||||
if repo.Org != "" {
|
||||
org = repo.Org
|
||||
}
|
||||
|
||||
created, _, err := g.client.Repositories.Create(*g.ctx, org, ghRepo)
|
||||
|
||||
return created, err
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
|
||||
pb "github.com/spotify/backstage/backend/proto/scaffolder/v1"
|
||||
"github.com/spotify/backstage/scaffolder/app"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
port = ":50051"
|
||||
)
|
||||
|
||||
func main() {
|
||||
lis, err := net.Listen("tcp", port)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
|
||||
grpcServer := grpc.NewServer()
|
||||
serverHandler := app.NewServer()
|
||||
|
||||
pb.RegisterScaffolderServer(grpcServer, serverHandler)
|
||||
log.Println("Serving Scaffolder Service")
|
||||
grpcServer.Serve(lis)
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// Repository Repository
|
||||
type Repository struct{}
|
||||
|
||||
// TemplateDefinition maps to whats stored in the repo
|
||||
type TemplateDefinition struct {
|
||||
ID string
|
||||
Name string
|
||||
Description string
|
||||
OwnerID string
|
||||
}
|
||||
|
||||
// Load will return all the Repository templates
|
||||
func (s *Repository) Load() ([]*TemplateDefinition, error) {
|
||||
var templateDefinitions []*TemplateDefinition
|
||||
|
||||
templateInfoFilePaths, err := filepath.Glob("templates/**/template-info.json")
|
||||
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to load template-info files")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, templatePath := range templateInfoFilePaths {
|
||||
content, err := ioutil.ReadFile(templatePath)
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to load path for %s", templatePath)
|
||||
continue
|
||||
}
|
||||
|
||||
definition := TemplateDefinition{}
|
||||
err = json.Unmarshal([]byte(content), &definition)
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to unmarshal %s", templatePath)
|
||||
continue
|
||||
}
|
||||
|
||||
templateDefinitions = append(templateDefinitions, &definition)
|
||||
}
|
||||
|
||||
return templateDefinitions, nil
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"app_id": "com.example.app",
|
||||
"app_name": "SampleApp",
|
||||
"owner": "",
|
||||
"description": "We promise to update this description /{{cookiecutter.owner}}"
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
{
|
||||
"schema": [
|
||||
{
|
||||
"id": "app_name",
|
||||
"title": "App name",
|
||||
"type": "text",
|
||||
"description": "App name used to generate Android Studio files and class names. CamelCase e.g. 'MyAndroidApp'",
|
||||
"validators": [
|
||||
{
|
||||
"type": "required"
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"match": "^[A-Z][A-Za-z]+$",
|
||||
"message": "Project name must be CamelCase"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "app_id",
|
||||
"title": "App ID",
|
||||
"type": "text",
|
||||
"description": "App id used as package for the new app. FQDN e.g. 'com.example.app'",
|
||||
"validators": [
|
||||
{
|
||||
"type": "required"
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"match": "^[a-z][a-z.]+$",
|
||||
"message": "App ID must be a fully qualified domain name"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "owner",
|
||||
"title": "owner",
|
||||
"type": "text",
|
||||
"description": "The owner name used to identify the owner of this component",
|
||||
"validators": [
|
||||
{
|
||||
"type": "required"
|
||||
},
|
||||
{
|
||||
"type": "string-range",
|
||||
"min": 4,
|
||||
"max": 33
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"match": "^[a-z][a-z0-9]+$",
|
||||
"message": "Owner names must consist only of lowercase letters"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,37 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "{{cookiecutter.app_id}}"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.core:core-ktx:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,24 +0,0 @@
|
||||
package {{cookiecutter.app_id}}
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.mytemplate", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="{{cookiecutter.app_id}}">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,12 +0,0 @@
|
||||
package {{cookiecutter.app_id}}
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
@@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello Backsage!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
</resources>
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">{{cookiecutter.app_name}}</string>
|
||||
</resources>
|
||||
@@ -1,11 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,17 +0,0 @@
|
||||
package {{cookiecutter.app_id}}
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.61'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.0-rc01'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
@@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,183 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -1,100 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,2 +0,0 @@
|
||||
rootProject.name='{{cookiecutter.app_name}}'
|
||||
include ':app'
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"module_id": "com.example.module",
|
||||
"module_name": "SampleModule",
|
||||
"owner": "",
|
||||
"description": "We promise to update this description /{{cookiecutter.owner}}"
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
{
|
||||
"schema": [
|
||||
{
|
||||
"id": "module_name",
|
||||
"title": "Module name",
|
||||
"type": "text",
|
||||
"description": "Module name used to generate Android Studio files and class names. CamelCase e.g. 'MyNewModule'",
|
||||
"validators": [
|
||||
{
|
||||
"type": "required"
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"match": "^[A-Z][A-Za-z]+$",
|
||||
"message": "Module name must be CamelCase"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "module_id",
|
||||
"title": "Module ID",
|
||||
"type": "text",
|
||||
"description": "Module id used as package for the new module. FQDN e.g. 'com.example.module'",
|
||||
"validators": [
|
||||
{
|
||||
"type": "required"
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"match": "^[a-z][a-z.]+$",
|
||||
"message": "Module ID must be a fully qualified domain name"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "owner",
|
||||
"title": "owner",
|
||||
"type": "text",
|
||||
"description": "The owner name used to identify the owner of this component",
|
||||
"validators": [
|
||||
{
|
||||
"type": "required"
|
||||
},
|
||||
{
|
||||
"type": "string-range",
|
||||
"min": 4,
|
||||
"max": 33
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"match": "^[a-z][a-z0-9]+$",
|
||||
"message": "Owner names must consist only of lowercase letters"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,36 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.core:core-ktx:1.2.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.example.module
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.mylibrary.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.module" />
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.example.module
|
||||
|
||||
/**
|
||||
* This is just an entry point for your new module
|
||||
*/
|
||||
class ExampleModuleClass {
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.example.module
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"id": "android-kotlin-module-template",
|
||||
"name": "Kotlin Module",
|
||||
"description": "Kotlin module sample",
|
||||
"ownerId": "ownerId"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,36 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.core:core-ktx:1.2.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||