Skip to content

add authorized network #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.0
version: v1.64.7

fmt:
name: fmt
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANGCI_VERSION=v1.56.2
GOLANGCI_VERSION=v1.64.7
COVERAGE=coverage.out

.PHONY: deps
Expand Down
1 change: 1 addition & 0 deletions docs/generate_doc/ticloud_serverless.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Manage TiDB Cloud Serverless clusters
### SEE ALSO

* [ticloud](ticloud.md) - CLI tool to manage TiDB Cloud
* [ticloud serverless authorized-network](ticloud_serverless_authorized-network.md) - Manage TiDB Cloud Serverless cluster authorized networks
* [ticloud serverless branch](ticloud_serverless_branch.md) - Manage TiDB Cloud Serverless branches
* [ticloud serverless capacity](ticloud_serverless_capacity.md) - Set capacity for a TiDB Cloud Serverless cluster
* [ticloud serverless create](ticloud_serverless_create.md) - Create a TiDB Cloud Serverless cluster
Expand Down
26 changes: 26 additions & 0 deletions docs/generate_doc/ticloud_serverless_authorized-network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## ticloud serverless authorized-network

Manage TiDB Cloud Serverless cluster authorized networks

### Options

```
-h, --help help for authorized-network
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless](ticloud_serverless.md) - Manage TiDB Cloud Serverless clusters
* [ticloud serverless authorized-network create](ticloud_serverless_authorized-network_create.md) - Create an authorized network
* [ticloud serverless authorized-network delete](ticloud_serverless_authorized-network_delete.md) - Delete an authorized network
* [ticloud serverless authorized-network list](ticloud_serverless_authorized-network_list.md) - List all authorized networks
* [ticloud serverless authorized-network update](ticloud_serverless_authorized-network_update.md) - Update an authorized network

40 changes: 40 additions & 0 deletions docs/generate_doc/ticloud_serverless_authorized-network_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## ticloud serverless authorized-network create

Create an authorized network

```
ticloud serverless authorized-network create [flags]
```

### Examples

```
Create an authorized network in interactive mode:
$ ticloud serverless authorized-network create

Create an authorized network in non-interactive mode:
$ ticloud serverless authorized-network create -c <cluster-id> --display-name <display-name> --start-ip-address <start-ip-address> --end-ip-address <end-ip-address>
```

### Options

```
-c, --cluster-id string The ID of the cluster.
-n, --display-name string The name of the authorized network.
--end-ip-address string The end IP address of the authorized network.
-h, --help help for create
--start-ip-address string The start IP address of the authorized network.
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless authorized-network](ticloud_serverless_authorized-network.md) - Manage TiDB Cloud Serverless cluster authorized networks

40 changes: 40 additions & 0 deletions docs/generate_doc/ticloud_serverless_authorized-network_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## ticloud serverless authorized-network delete

Delete an authorized network

```
ticloud serverless authorized-network delete [flags]
```

### Examples

```
Delete an authorized network in interactive mode:
$ ticloud serverless authorized-network delete

Delete an authorized network in non-interactive mode:
$ ticloud serverless authorized-network delete -c <cluster-id> --start-ip-address <start-ip-address> --end-ip-address <end-ip-address>
```

### Options

```
-c, --cluster-id string The ID of the cluster.
--end-ip-address string The end IP address of the authorized network.
--force Delete an authorized network without confirmation.
-h, --help help for delete
--start-ip-address string The start IP address of the authorized network.
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless authorized-network](ticloud_serverless_authorized-network.md) - Manage TiDB Cloud Serverless cluster authorized networks

41 changes: 41 additions & 0 deletions docs/generate_doc/ticloud_serverless_authorized-network_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## ticloud serverless authorized-network list

List all authorized networks

```
ticloud serverless authorized-network list [flags]
```

### Examples

```
List all authorized networks in interactive mode:
$ ticloud serverless authorized-network list

List all authorized networks in non-interactive mode:
$ ticloud serverless authorized-network list -c <cluster-id>

List all authorized networks with json format:
$ ticloud serverless authorized-network list -o json
```

### Options

```
-c, --cluster-id string The ID of the cluster.
-h, --help help for list
-o, --output string Output format, one of ["human" "json"]. For the complete result, please use json format. (default "human")
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless authorized-network](ticloud_serverless_authorized-network.md) - Manage TiDB Cloud Serverless cluster authorized networks

42 changes: 42 additions & 0 deletions docs/generate_doc/ticloud_serverless_authorized-network_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## ticloud serverless authorized-network update

Update an authorized network

```
ticloud serverless authorized-network update [flags]
```

### Examples

```
Update an authorized network in interactive mode:
$ ticloud serverless authorized-network update

Update an authorized network in non-interactive mode:
$ ticloud serverless authorized-network update -c <cluster-id> --ip-range <ip-range> --display-name <display-name>
```

### Options

```
-c, --cluster-id string The ID of the cluster.
--end-ip-address string The end IP address of the authorized network.
-h, --help help for update
--new-display-name string The new display name of the authorized network.
--new-end-ip-address string The new end IP address of the authorized network.
--new-start-ip-address string The new start IP address of the authorized network.
--start-ip-address string The start IP address of the authorized network.
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless authorized-network](ticloud_serverless_authorized-network.md) - Manage TiDB Cloud Serverless cluster authorized networks

2 changes: 1 addition & 1 deletion docs/generate_doc/ticloud_serverless_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ticloud serverless create [flags]
Create a TiDB Cloud Serverless cluster in interactive mode:
$ ticloud serverless create

Create a TiDB Cloud Serverless cluster of the default ptoject in non-interactive mode:
Create a TiDB Cloud Serverless cluster of the default project in non-interactive mode:
$ ticloud serverless create --display-name <cluster-name> --region <region>

Create a TiDB Cloud Serverless cluster in non-interactive mode:
Expand Down
35 changes: 35 additions & 0 deletions internal/cli/serverless/authorizednetwork/authorized_network.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2025 PingCAP, Inc.
//
// 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
//
// http://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.

package authorizednetwork

import (
"github.com/tidbcloud/tidbcloud-cli/internal"

"github.com/spf13/cobra"
)

func AuthorizedNetworkCmd(h *internal.Helper) *cobra.Command {
var authorizedNetworkCmd = &cobra.Command{
Use: "authorized-network",
Short: "Manage TiDB Cloud Serverless cluster authorized networks",
}

authorizedNetworkCmd.AddCommand(CreateCmd(h))
authorizedNetworkCmd.AddCommand(DeleteCmd(h))
authorizedNetworkCmd.AddCommand(UpdateCmd(h))
authorizedNetworkCmd.AddCommand(ListCmd(h))

return authorizedNetworkCmd
}
Loading
Loading