-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLOUDP-108667: Get all the private endpoints for the Data Lake in the…
… specified project. (#917)
- Loading branch information
1 parent
f28c053
commit 53b6e8d
Showing
16 changed files
with
514 additions
and
5 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
docs/command/mongocli-atlas-privateEndpoints-dataLakes-aws-list.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.. _mongocli-atlas-privateEndpoints-dataLakes-aws-list: | ||
|
||
================================================== | ||
mongocli atlas privateEndpoints dataLakes aws list | ||
================================================== | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
List Data Lake private endpoints for your project. | ||
|
||
Syntax | ||
------ | ||
|
||
.. code-block:: | ||
|
||
mongocli atlas privateEndpoints dataLakes aws list [options] | ||
|
||
Options | ||
------- | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:widths: 20 10 10 60 | ||
|
||
* - Name | ||
- Type | ||
- Required | ||
- Description | ||
* - -h, --help | ||
- | ||
- false | ||
- help for list | ||
* - -o, --output | ||
- string | ||
- false | ||
- Output format. Valid values are json, json-path, go-template, or go-template-file. | ||
* - --projectId | ||
- string | ||
- false | ||
- Project ID to use. Overrides the settings in the configuration file or environment variable. | ||
|
||
Inherited Options | ||
----------------- | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:widths: 20 10 10 60 | ||
|
||
* - Name | ||
- Type | ||
- Required | ||
- Description | ||
* - -P, --profile | ||
- string | ||
- false | ||
- Profile to use from your configuration file. | ||
|
59 changes: 59 additions & 0 deletions
59
docs/command/mongocli-atlas-privateEndpoints-dataLakes-aws.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.. _mongocli-atlas-privateEndpoints-dataLakes-aws: | ||
|
||
============================================= | ||
mongocli atlas privateEndpoints dataLakes aws | ||
============================================= | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
Manage AWS private endpoints. | ||
|
||
Options | ||
------- | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:widths: 20 10 10 60 | ||
|
||
* - Name | ||
- Type | ||
- Required | ||
- Description | ||
* - -h, --help | ||
- | ||
- false | ||
- help for aws | ||
|
||
Inherited Options | ||
----------------- | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:widths: 20 10 10 60 | ||
|
||
* - Name | ||
- Type | ||
- Required | ||
- Description | ||
* - -P, --profile | ||
- string | ||
- false | ||
- Profile to use from your configuration file. | ||
|
||
Related Commands | ||
---------------- | ||
|
||
* :ref:`mongocli-atlas-privateEndpoints-dataLakes-aws-list` - List Data Lake private endpoints for your project. | ||
|
||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
list </command/mongocli-atlas-privateEndpoints-dataLakes-aws-list> | ||
|
59 changes: 59 additions & 0 deletions
59
docs/command/mongocli-atlas-privateEndpoints-dataLakes.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.. _mongocli-atlas-privateEndpoints-dataLakes: | ||
|
||
========================================= | ||
mongocli atlas privateEndpoints dataLakes | ||
========================================= | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
Manage Data Lake private endpoints. | ||
|
||
Options | ||
------- | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:widths: 20 10 10 60 | ||
|
||
* - Name | ||
- Type | ||
- Required | ||
- Description | ||
* - -h, --help | ||
- | ||
- false | ||
- help for dataLakes | ||
|
||
Inherited Options | ||
----------------- | ||
|
||
.. list-table:: | ||
:header-rows: 1 | ||
:widths: 20 10 10 60 | ||
|
||
* - Name | ||
- Type | ||
- Required | ||
- Description | ||
* - -P, --profile | ||
- string | ||
- false | ||
- Profile to use from your configuration file. | ||
|
||
Related Commands | ||
---------------- | ||
|
||
* :ref:`mongocli-atlas-privateEndpoints-dataLakes-aws` - Manage AWS private endpoints. | ||
|
||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
aws </command/mongocli-atlas-privateEndpoints-dataLakes-aws> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2022 MongoDB 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 aws | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func Builder() *cobra.Command { | ||
const use = "aws" | ||
cmd := &cobra.Command{ | ||
Use: use, | ||
Short: "Manage AWS private endpoints.", | ||
} | ||
cmd.AddCommand(ListBuilder()) | ||
|
||
return cmd | ||
} |
33 changes: 33 additions & 0 deletions
33
internal/cli/atlas/privateendpoints/datalake/aws/aws_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2022 MongoDB 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. | ||
|
||
//go:build unit | ||
// +build unit | ||
|
||
package aws | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/mongodb/mongocli/internal/test" | ||
) | ||
|
||
func TestBuilder(t *testing.T) { | ||
test.CmdValidator( | ||
t, | ||
Builder(), | ||
1, | ||
[]string{}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2022 MongoDB 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 aws | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/mongodb/mongocli/internal/cli" | ||
"github.com/mongodb/mongocli/internal/cli/require" | ||
"github.com/mongodb/mongocli/internal/config" | ||
"github.com/mongodb/mongocli/internal/flag" | ||
"github.com/mongodb/mongocli/internal/store" | ||
"github.com/mongodb/mongocli/internal/usage" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var listTemplate = `ID ENDPOINT PROVIDER TYPE COMMENT{{range .Results}} | ||
{{.EndpointID}} {{.Provider}} {{.Type}} {{.Comment}}{{end}} | ||
` | ||
|
||
type ListOpts struct { | ||
cli.GlobalOpts | ||
cli.OutputOpts | ||
store store.DataLakePrivateEndpointLister | ||
} | ||
|
||
func (opts *ListOpts) initStore(ctx context.Context) func() error { | ||
return func() error { | ||
var err error | ||
opts.store, err = store.New(store.AuthenticatedPreset(config.Default()), store.WithContext(ctx)) | ||
return err | ||
} | ||
} | ||
|
||
func (opts *ListOpts) Run() error { | ||
r, err := opts.store.DataLakePrivateEndpoints(opts.ConfigProjectID()) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
return opts.Print(r) | ||
} | ||
|
||
// mongocli atlas privateEndpoint(s)|privateendpoint(s) dataLakes aws list|ls [--projectId projectId]. | ||
func ListBuilder() *cobra.Command { | ||
opts := new(ListOpts) | ||
cmd := &cobra.Command{ | ||
Use: "list", | ||
Aliases: []string{"ls"}, | ||
Short: "List Data Lake private endpoints for your project.", | ||
Args: require.NoArgs, | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
return opts.PreRunE( | ||
opts.ValidateProjectID, | ||
opts.initStore(cmd.Context()), | ||
opts.InitOutput(cmd.OutOrStdout(), listTemplate), | ||
) | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return opts.Run() | ||
}, | ||
} | ||
|
||
cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID) | ||
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut) | ||
|
||
return cmd | ||
} |
Oops, something went wrong.