Skip to content

Commit 803f936

Browse files
authored
Merge branch 'master' into tener/disable-default-import-rule
2 parents 136007c + d4bdb76 commit 803f936

File tree

444 files changed

+22676
-9763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

444 files changed

+22676
-9763
lines changed

.github/workflows/docs-amplify.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Docs Preview
2+
on:
3+
pull_request:
4+
paths:
5+
- 'docs/**'
6+
- .github/workflows/docs-amplify.yaml
7+
workflow_dispatch:
8+
9+
permissions:
10+
pull-requests: write
11+
id-token: write
12+
13+
jobs:
14+
amplify-preview:
15+
name: Prepare Amplify preview URL
16+
runs-on: ubuntu-22.04-2core-arm64
17+
environment: docs-amplify
18+
steps:
19+
- name: Configure AWS credentials
20+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
21+
with:
22+
aws-region: us-west-2
23+
role-to-assume: ${{ vars.IAM_ROLE }}
24+
25+
- name: Create Amplify preview environment
26+
uses: gravitational/shared-workflows/tools/amplify-preview@tools/amplify-preview/v0.0.1
27+
continue-on-error: true
28+
with:
29+
app_ids: ${{ vars.AMPLIFY_APP_IDS }}
30+
create_branches: "true"
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
wait: "true"
33+
34+
- name: Print failure message
35+
if: failure()
36+
env:
37+
ERR_TITLE: Teleport Docs preview build failed
38+
ERR_MESSAGE: >-
39+
Please refer to the following documentation for help: https://www.notion.so/goteleport/How-to-Amplify-deployments-162fdd3830be8096ba72efa1a49ee7bc?pvs=4
40+
run: |
41+
echo ::error title=$ERR_TITLE::$ERR_MESSAGE
42+
exit 1

.golangci.yml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,55 @@ issues:
99
exclude-dirs-use-default: false
1010
exclude-rules:
1111
- linters:
12-
- gosimple
13-
text: "S1002: should omit comparison to bool constant"
12+
- gosimple
13+
text: 'S1002: should omit comparison to bool constant'
1414
- linters:
15-
- revive
16-
text: "exported: exported const"
15+
- revive
16+
text: 'exported: exported const'
1717
# TODO(hugoShaka): Remove once https://github.com/dominikh/go-tools/issues/1294 is fixed
1818
- linters:
19-
- unused
19+
- unused
2020
path: 'integrations/operator/controllers/resources/(.+)_controller_test\.go'
2121
# TODO(codingllama): Remove once we move to grpc.NewClient.
2222
- linters: [staticcheck]
23-
text: "grpc.Dial is deprecated"
23+
text: 'grpc.Dial is deprecated'
2424
- linters: [staticcheck]
25-
text: "grpc.DialContext is deprecated"
25+
text: 'grpc.DialContext is deprecated'
2626
# Deprecated gRPC dial options. Related to grpc.NewClient.
2727
- path: (client/client.go|client/proxy/client_test.go) # api/
2828
linters: [staticcheck]
2929
# grpc.FailOnNonTempDialError
3030
# grpc.WithReturnConnectionError
31-
text: "this DialOption is not supported by NewClient"
31+
text: 'this DialOption is not supported by NewClient'
3232
- path: lib/kube/grpc/grpc_test.go
3333
linters: [staticcheck]
34-
text: "grpc.WithBlock is deprecated"
34+
text: 'grpc.WithBlock is deprecated'
3535
- path: lib/observability/tracing/client.go
3636
linters: [staticcheck]
37-
text: "grpc.WithBlock is deprecated"
37+
text: 'grpc.WithBlock is deprecated'
3838
- path: integrations/lib/config.go
3939
linters: [staticcheck]
40-
text: "grpc.WithReturnConnectionError is deprecated"
40+
text: 'grpc.WithReturnConnectionError is deprecated'
4141
- path: lib/service/service_test.go
4242
linters: [staticcheck]
4343
# grpc.WithReturnConnectionError
4444
# grpc.FailOnNonTempDialError
45-
text: "this DialOption is not supported by NewClient"
45+
text: 'this DialOption is not supported by NewClient'
4646
- path: integration/client_test.go
4747
linters: [staticcheck]
48-
text: "grpc.WithReturnConnectionError is deprecated"
48+
text: 'grpc.WithReturnConnectionError is deprecated'
4949
- path: integration/integration_test.go
5050
linters: [staticcheck]
51-
text: "grpc.WithBlock is deprecated"
51+
text: 'grpc.WithBlock is deprecated'
5252
- path: lib/multiplexer/multiplexer_test.go
5353
linters: [staticcheck]
54-
text: "grpc.WithBlock is deprecated"
54+
text: 'grpc.WithBlock is deprecated'
5555
- path: provider/provider.go # integrations/terraform
5656
linters: [staticcheck]
57-
text: "grpc.WithReturnConnectionError is deprecated"
57+
text: 'grpc.WithReturnConnectionError is deprecated'
5858
- linters: [govet]
59-
text: "non-constant format string in call to github.com/gravitational/trace."
59+
path-except: ^e/
60+
text: 'non-constant format string in call to github.com/gravitational/trace.'
6061
exclude-use-default: true
6162
max-same-issues: 0
6263
max-issues-per-linter: 0
@@ -121,6 +122,7 @@ linters-settings:
121122
files:
122123
- '**/api/**'
123124
- '**/e/**'
125+
- '**/lib/srv/**'
124126
deny:
125127
- pkg: github.com/sirupsen/logrus
126128
desc: 'use "log/slog" instead'
@@ -130,7 +132,7 @@ linters-settings:
130132
client-tools:
131133
files:
132134
# Tests can do anything
133-
- "!$test"
135+
- '!$test'
134136
- '**/tool/tbot/**'
135137
- '**/lib/tbot/**'
136138
- '**/tool/tctl/**'
@@ -158,7 +160,7 @@ linters-settings:
158160
cgo:
159161
files:
160162
# Tests can do anything
161-
- "!$test"
163+
- '!$test'
162164
- '**/tool/tbot/**'
163165
- '**/lib/client/**'
164166
- '!**/lib/integrations/**'
@@ -240,8 +242,8 @@ linters-settings:
240242
require-specific: true
241243
revive:
242244
rules:
243-
- name: unused-parameter
244-
disabled: true
245+
- name: unused-parameter
246+
disabled: true
245247
sloglint:
246248
context: all
247249
key-naming-case: snake

api/client/client.go

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,12 +2286,56 @@ func (c *Client) GetTrustedClusters(ctx context.Context) ([]types.TrustedCluster
22862286
}
22872287

22882288
// UpsertTrustedCluster creates or updates a Trusted Cluster.
2289-
func (c *Client) UpsertTrustedCluster(ctx context.Context, trusedCluster types.TrustedCluster) (types.TrustedCluster, error) {
2290-
trustedCluster, ok := trusedCluster.(*types.TrustedClusterV2)
2289+
//
2290+
// Deprecated: Use [Client.UpsertTrustedClusterV2] instead.
2291+
func (c *Client) UpsertTrustedCluster(ctx context.Context, trustedCluster types.TrustedCluster) (types.TrustedCluster, error) {
2292+
trustedClusterV2, ok := trustedCluster.(*types.TrustedClusterV2)
22912293
if !ok {
2292-
return nil, trace.BadParameter("invalid type %T", trusedCluster)
2294+
return nil, trace.BadParameter("invalid type %T", trustedCluster)
22932295
}
2294-
resp, err := c.grpc.UpsertTrustedCluster(ctx, trustedCluster)
2296+
resp, err := c.grpc.UpsertTrustedCluster(ctx, trustedClusterV2)
2297+
if err != nil {
2298+
return nil, trace.Wrap(err)
2299+
}
2300+
return resp, nil
2301+
}
2302+
2303+
// UpsertTrustedClusterV2 creates or updates a Trusted Cluster.
2304+
func (c *Client) UpsertTrustedClusterV2(ctx context.Context, trustedCluster types.TrustedCluster) (types.TrustedCluster, error) {
2305+
trustedClusterV2, ok := trustedCluster.(*types.TrustedClusterV2)
2306+
if !ok {
2307+
return nil, trace.BadParameter("invalid type %T", trustedCluster)
2308+
}
2309+
req := &trustpb.UpsertTrustedClusterRequest{TrustedCluster: trustedClusterV2}
2310+
resp, err := c.TrustClient().UpsertTrustedCluster(ctx, req)
2311+
if err != nil {
2312+
return nil, trace.Wrap(err)
2313+
}
2314+
return resp, nil
2315+
}
2316+
2317+
// CreateTrustedCluster creates a Trusted Cluster.
2318+
func (c *Client) CreateTrustedCluster(ctx context.Context, trustedCluster types.TrustedCluster) (types.TrustedCluster, error) {
2319+
trustedClusterV2, ok := trustedCluster.(*types.TrustedClusterV2)
2320+
if !ok {
2321+
return nil, trace.BadParameter("invalid type %T", trustedCluster)
2322+
}
2323+
req := &trustpb.CreateTrustedClusterRequest{TrustedCluster: trustedClusterV2}
2324+
resp, err := c.TrustClient().CreateTrustedCluster(ctx, req)
2325+
if err != nil {
2326+
return nil, trace.Wrap(err)
2327+
}
2328+
return resp, nil
2329+
}
2330+
2331+
// UpdateTrustedCluster updates a Trusted Cluster.
2332+
func (c *Client) UpdateTrustedCluster(ctx context.Context, trustedCluster types.TrustedCluster) (types.TrustedCluster, error) {
2333+
trustedClusterV2, ok := trustedCluster.(*types.TrustedClusterV2)
2334+
if !ok {
2335+
return nil, trace.BadParameter("invalid type %T", trustedCluster)
2336+
}
2337+
req := &trustpb.UpdateTrustedClusterRequest{TrustedCluster: trustedClusterV2}
2338+
resp, err := c.TrustClient().UpdateTrustedCluster(ctx, req)
22952339
if err != nil {
22962340
return nil, trace.Wrap(err)
22972341
}
@@ -4262,6 +4306,12 @@ func (c *Client) GetSSHTargets(ctx context.Context, req *proto.GetSSHTargetsRequ
42624306
return rsp, trace.Wrap(err)
42634307
}
42644308

4309+
// ResolveSSHTarget gets a server that would match an equivalent ssh dial request.
4310+
func (c *Client) ResolveSSHTarget(ctx context.Context, req *proto.ResolveSSHTargetRequest) (*proto.ResolveSSHTargetResponse, error) {
4311+
rsp, err := c.grpc.ResolveSSHTarget(ctx, req)
4312+
return rsp, trace.Wrap(err)
4313+
}
4314+
42654315
// CreateSessionTracker creates a tracker resource for an active session.
42664316
func (c *Client) CreateSessionTracker(ctx context.Context, st types.SessionTracker) (types.SessionTracker, error) {
42674317
v1, ok := st.(*types.SessionTrackerV1)
@@ -5091,6 +5141,52 @@ func (c *Client) UpsertUserLastSeenNotification(ctx context.Context, req *notifi
50915141
return rsp, trace.Wrap(err)
50925142
}
50935143

5144+
// GetWorkloadIdentity returns a workload identity by name.
5145+
func (c *Client) GetWorkloadIdentity(ctx context.Context, name string) (*workloadidentityv1pb.WorkloadIdentity, error) {
5146+
resp, err := c.WorkloadIdentityResourceServiceClient().GetWorkloadIdentity(ctx, &workloadidentityv1pb.GetWorkloadIdentityRequest{
5147+
Name: name,
5148+
})
5149+
if err != nil {
5150+
return nil, trace.Wrap(err)
5151+
}
5152+
return resp, nil
5153+
}
5154+
5155+
// DeleteWorkloadIdentity deletes a workload identity by name. It will throw an
5156+
// error if the workload identity does not exist.
5157+
func (c *Client) DeleteWorkloadIdentity(ctx context.Context, name string) error {
5158+
_, err := c.WorkloadIdentityResourceServiceClient().DeleteWorkloadIdentity(ctx, &workloadidentityv1pb.DeleteWorkloadIdentityRequest{
5159+
Name: name,
5160+
})
5161+
if err != nil {
5162+
return trace.Wrap(err)
5163+
}
5164+
return nil
5165+
}
5166+
5167+
// CreateWorkloadIdentity creates a new workload identity, it will not overwrite
5168+
// an existing workload identity with the same name.
5169+
func (c *Client) CreateWorkloadIdentity(ctx context.Context, r *workloadidentityv1pb.WorkloadIdentity) (*workloadidentityv1pb.WorkloadIdentity, error) {
5170+
resp, err := c.WorkloadIdentityResourceServiceClient().CreateWorkloadIdentity(ctx, &workloadidentityv1pb.CreateWorkloadIdentityRequest{
5171+
WorkloadIdentity: r,
5172+
})
5173+
if err != nil {
5174+
return nil, trace.Wrap(err)
5175+
}
5176+
return resp, nil
5177+
}
5178+
5179+
// UpsertWorkloadIdentity creates or updates a workload identity.
5180+
func (c *Client) UpsertWorkloadIdentity(ctx context.Context, r *workloadidentityv1pb.WorkloadIdentity) (*workloadidentityv1pb.WorkloadIdentity, error) {
5181+
resp, err := c.WorkloadIdentityResourceServiceClient().UpsertWorkloadIdentity(ctx, &workloadidentityv1pb.UpsertWorkloadIdentityRequest{
5182+
WorkloadIdentity: r,
5183+
})
5184+
if err != nil {
5185+
return nil, trace.Wrap(err)
5186+
}
5187+
return resp, nil
5188+
}
5189+
50945190
// ResourceUsageClient returns an unadorned Resource Usage service client,
50955191
// using the underlying Auth gRPC connection.
50965192
// Clients connecting to non-Enterprise clusters, or older Teleport versions,

0 commit comments

Comments
 (0)