Skip to content

Commit f33a508

Browse files
committed
init commit
0 parents  commit f33a508

35 files changed

Lines changed: 9262 additions & 0 deletions

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
# Maintain dependencies for gomod
9+
- package-ecosystem: "gomod" # See documentation for possible values
10+
directory: "/" # Location of package manifests
11+
schedule:
12+
interval: "daily"
13+
# Maintain dependencies for GitHub Actions
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Pull Request Pipeline
2+
on: [pull_request]
3+
jobs:
4+
tests:
5+
runs-on: ubuntu-latest
6+
name: sanity checks - pull request
7+
steps:
8+
- uses: actions/checkout@v3
9+
- uses: actions/setup-go@v3
10+
with:
11+
go-version: '^1.18'
12+
- name: run tests and build
13+
run: make clean test bins
14+
- name: lint
15+
run: make tools lint

.github/workflows/security.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Leaked Secrets Scan
2+
on: [pull_request]
3+
jobs:
4+
TruffleHog:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout code
8+
uses: actions/checkout@v3
9+
with:
10+
fetch-depth: 0
11+
- name: TruffleHog OSS
12+
uses: trufflesecurity/trufflehog@v3.4.3
13+
with:
14+
path: ./
15+
base: ${{ github.event.repository.default_branch }}
16+
head: HEAD

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/tcld
2+
/releases
3+
/proto
4+
.vscode/
5+
.idea/
6+
/.coverage

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2022 Temporal Technologies Inc. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Makefile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
.PHONY: clean test bins lint tools
2+
PROJECT_ROOT = github.com/temporalio/tcld
3+
4+
# default target
5+
default: clean test bins
6+
7+
TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
8+
TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
9+
COMMIT := $(shell git rev-parse --short HEAD)
10+
DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d")
11+
VERSION := $(TAG:v%=%)
12+
APPPKG := $(PROJECT_ROOT)/app
13+
LINKER_FLAGS := -X $(APPPKG).BuildDate=$(DATE) -X $(APPPKG).Commit=$(COMMIT) -X $(APPPKG).Version=$(VERSION)
14+
15+
16+
ALL_SRC := $(shell find . -name "*.go")
17+
TEST_DIRS := $(sort $(dir $(filter %_test.go,$(ALL_SRC))))
18+
TEST_ARG ?= -race -timeout=5m -cover -count=1
19+
20+
tcld:
21+
@go build -ldflags "$(LINKER_FLAGS)" -o tcld ./cmd/tcld/*.go
22+
23+
bins: tcld
24+
25+
test:
26+
@$(foreach TEST_DIR,$(TEST_DIRS),\
27+
go test $(TEST_ARG) $(TEST_DIR) &&) echo passed
28+
29+
clean:
30+
@rm -rf ./tcld
31+
32+
define build
33+
@echo "building release for $(1) $(2) $(3)..."
34+
@mkdir -p releases
35+
@GOOS=$(2) GOARCH=$(3) go build -ldflags "-w $(LINKER_FLAGS)" -o releases/$(1)_$(2)_$(3)$(4) ./cmd/tcld/*.go
36+
@tar -cvzf releases/$(1)_$(2)_$(3).tar.gz releases/$(1)_$(2)_$(3)$(4) &>/dev/null
37+
endef
38+
39+
release:
40+
@rm -rf releases && mkdir -p releases
41+
$(call build,tcld,linux,amd64)
42+
$(call build,tcld,darwin,amd64,)
43+
$(call build,tcld,darwin,arm64,)
44+
$(call build,tcld,windows,amd64,.exe)
45+
46+
tools:
47+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2
48+
@GO111MODULE=off go get -u github.com/golang/mock/mockgen
49+
50+
lint:
51+
golangci-lint run
52+
53+
mocks:
54+
@mockgen -source services/loginservice.go -destination services/loginservicemock.go -package services

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# tcld (`Beta`)
2+
A cli tool for temporal cloud operations.
3+
4+
> This cli tool is currently in `beta` and access to temporal cloud using the cli is restricted. Please reach out to temporal-cloud support for more information.
5+
6+
# Installation
7+
## Build from source
8+
1. Verify that you have Go 1.18+ installed. If `go` is not installed, follow instructions on [the Go website](https://golang.org/doc/install).
9+
```sh
10+
$ go version
11+
```
12+
2. Run go install.
13+
```
14+
$ go install github.com/temporalio/tcld/cmd/tcld@latest
15+
```
16+
3. Run `tcld version` to check if it worked.
17+
```
18+
$ tcld version
19+
```
20+
21+
# Authentication and Login
22+
In order to use the cli you must first login by running the following command:
23+
```
24+
$ tcld login
25+
```
26+
You will be sent a link to confirm your device code and login. After logging in, you are now authenticated and can make requests with this cli.
27+
28+
# Namespace Management
29+
30+
### List namespaces user has access to:
31+
```
32+
$ tcld namespace list
33+
```
34+
35+
### Get namespace information:
36+
```
37+
$ tcld namespace get -n <namespace>
38+
```
39+
40+
### Update the ca certificate:
41+
```
42+
$ tcld namespace update accepted-client-ca set -n <namespace> --ca-certificate-file <ca-pem-filepath>
43+
```
44+
> :warning: Any clients (tctl/workers) using the old certificates will fail to connect to the namespace after the update.
45+
46+
### Add new search attributes:
47+
```
48+
$ tcld namespace update search-attributes add -n <namespace> --sa "<attribute-name>=<search-attribute-type>" --sa "<attribute-name>=<search-attribute-type>"
49+
```
50+
Supported search attribute types: `SearchAttributeTypeKeyword SearchAttributeTypeText SearchAttributeTypeInt SearchAttributeTypeDouble SearchAttributeTypeDatetime SearchAttributeTypeBool`
51+
52+
### Rename existing search attribute:
53+
```
54+
$ tcld namespace update search-attributes rename -n <namespace> --existing-name <existing-attribute-name> --new-name <new-attribute-name>
55+
```
56+
> :warning: Any workflows that are use the old search attribute name will fail after the update.
57+
58+
# Asynchronous Operations
59+
Any update operations making changes to the namespaces hosted on temporal-cloud are async. Such operations are tracked using `request-id` that can be passed in when invoking the update operation or will be autogenerated if one is not passed. Once a asynchronous request is initiated a `request-id` is returned. Use the `request get` command to query the status of an asynchronous request.
60+
```
61+
$ tcld request get -r <request-id> -n <namespace>
62+
```
63+
64+
# License
65+
66+
MIT License, please see [LICENSE](https://github.com/temporalio/tcld/blob/master/LICENSE) for details.

0 commit comments

Comments
 (0)