Skip to content

Commit f0c39af

Browse files
authored
CLOUDP-178268 reenable "atlas datalakepipelines availablesnapshots list" (#1954)
1 parent 6b8899d commit f0c39af

File tree

10 files changed

+188
-34
lines changed

10 files changed

+188
-34
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
.. _atlas-dataLakePipelines-availableSnapshots-list:
2+
3+
===============================================
4+
atlas dataLakePipelines availableSnapshots list
5+
===============================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Return all available backup snapshots for the specified data lake pipeline.
16+
17+
To use this command, you must authenticate with a user account or an API key that has the Project Read Only role.
18+
19+
Syntax
20+
------
21+
22+
.. code-block::
23+
:caption: Command Syntax
24+
25+
atlas dataLakePipelines availableSnapshots list [options]
26+
27+
.. Code end marker, please don't delete this comment
28+
29+
Options
30+
-------
31+
32+
.. list-table::
33+
:header-rows: 1
34+
:widths: 20 10 10 60
35+
36+
* - Name
37+
- Type
38+
- Required
39+
- Description
40+
* - --completedAfter
41+
- string
42+
- false
43+
- Date filter of which the backup snapshots where completed. Format must be YYYY-MM-DD
44+
* - -h, --help
45+
-
46+
- false
47+
- help for list
48+
* - --limit
49+
- int
50+
- false
51+
- Number of items per results page. This value defaults to 100.
52+
* - -o, --output
53+
- string
54+
- false
55+
- Output format. Valid values are json, json-path, go-template, or go-template-file.
56+
* - --page
57+
- int
58+
- false
59+
- Page number that specifies a page of results. This value defaults to 1.
60+
* - --pipeline
61+
- string
62+
- true
63+
- Name of the Data lake pipeline.
64+
* - --projectId
65+
- string
66+
- false
67+
- Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
68+
69+
Inherited Options
70+
-----------------
71+
72+
.. list-table::
73+
:header-rows: 1
74+
:widths: 20 10 10 60
75+
76+
* - Name
77+
- Type
78+
- Required
79+
- Description
80+
* - -P, --profile
81+
- string
82+
- false
83+
- Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
84+
85+
Examples
86+
--------
87+
88+
.. code-block::
89+
90+
# list available backup schedules for data lake pipeline called 'Pipeline1':
91+
atlas dataLakePipelines availableSnapshots list Pipeline1
92+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. _atlas-dataLakePipelines-availableSnapshots:
2+
3+
==========================================
4+
atlas dataLakePipelines availableSnapshots
5+
==========================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Manage available backup snapshots for data lake pipelines.
16+
17+
Options
18+
-------
19+
20+
.. list-table::
21+
:header-rows: 1
22+
:widths: 20 10 10 60
23+
24+
* - Name
25+
- Type
26+
- Required
27+
- Description
28+
* - -h, --help
29+
-
30+
- false
31+
- help for availableSnapshots
32+
33+
Inherited Options
34+
-----------------
35+
36+
.. list-table::
37+
:header-rows: 1
38+
:widths: 20 10 10 60
39+
40+
* - Name
41+
- Type
42+
- Required
43+
- Description
44+
* - -P, --profile
45+
- string
46+
- false
47+
- Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
48+
49+
Related Commands
50+
----------------
51+
52+
* :ref:`atlas-dataLakePipelines-availableSnapshots-list` - Return all available backup snapshots for the specified data lake pipeline.
53+
54+
55+
.. toctree::
56+
:titlesonly:
57+
58+
list </command/atlas-dataLakePipelines-availableSnapshots-list>
59+

docs/atlascli/command/atlas-dataLakePipelines.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Related Commands
5050
----------------
5151

5252
* :ref:`atlas-dataLakePipelines-availableSchedules` - Manage available schedules for the specified data lake pipeline.
53+
* :ref:`atlas-dataLakePipelines-availableSnapshots` - Manage available backup snapshots for data lake pipelines.
5354
* :ref:`atlas-dataLakePipelines-create` - Creates a new Data Lake Pipeline.
5455
* :ref:`atlas-dataLakePipelines-datasets` - Manage datasets for the specified data lake pipeline.
5556
* :ref:`atlas-dataLakePipelines-delete` - Remove the specified data lake pipeline from your project.
@@ -67,6 +68,7 @@ Related Commands
6768
:titlesonly:
6869

6970
availableSchedules </command/atlas-dataLakePipelines-availableSchedules>
71+
availableSnapshots </command/atlas-dataLakePipelines-availableSnapshots>
7072
create </command/atlas-dataLakePipelines-create>
7173
datasets </command/atlas-dataLakePipelines-datasets>
7274
delete </command/atlas-dataLakePipelines-delete>

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ require (
3939
github.com/stretchr/testify v1.8.2
4040
github.com/tangzero/inflector v1.0.0
4141
github.com/withfig/autocomplete-tools/packages/cobra v1.2.0
42-
go.mongodb.org/atlas v0.26.2-0.20230518152935-67df00231ba6
42+
go.mongodb.org/atlas v0.25.1-0.20230522162956-d4f376b72f78
4343
go.mongodb.org/mongo-driver v1.11.4
4444
go.mongodb.org/ops-manager v0.50.0
4545
golang.org/x/crypto v0.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
436436
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
437437
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
438438
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
439-
go.mongodb.org/atlas v0.26.2-0.20230518152935-67df00231ba6 h1:T2A/VEZ1v7d1C5HOdagFis40hP6F8Vru1+WYta/iNzw=
440-
go.mongodb.org/atlas v0.26.2-0.20230518152935-67df00231ba6/go.mod h1:sZ7wAszLXP2JNaWysQnvnL7cB2d32noqUi3vr2IPF5s=
439+
go.mongodb.org/atlas v0.25.1-0.20230522162956-d4f376b72f78 h1:JafEV07Uj8FCsIpf3q2I3l64rlS9KrVdIFarlL9LZ8s=
440+
go.mongodb.org/atlas v0.25.1-0.20230522162956-d4f376b72f78/go.mod h1:sZ7wAszLXP2JNaWysQnvnL7cB2d32noqUi3vr2IPF5s=
441441
go.mongodb.org/mongo-driver v1.11.4 h1:4ayjakA013OdpGyL2K3ZqylTac/rMjrJOMZ1EHizXas=
442442
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
443443
go.mongodb.org/ops-manager v0.50.0 h1:H6OX1OJjNaUjO+mu+2XtPGPZHrwHBb4/Hn4ln+QF7uk=

internal/cli/atlas/datalakepipelines/availablesnapshots/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import (
3131
"github.com/spf13/cobra"
3232
)
3333

34-
var listTemplate = `ID STATUS{{range .Results}}
35-
{{if .DiskBackupReplicaSet}}{{.DiskBackupReplicaSet.Id}} {{.DiskBackupReplicaSet.Status}}{{else}}{{.DiskBackupShardedClusterSnapshot.Id}} {{.DiskBackupShardedClusterSnapshot.Status}}{{end}}{{end}}`
34+
var listTemplate = `ID DESCRIPTION STATUS{{range .Results}}
35+
{{if .DiskBackupReplicaSet}}{{.DiskBackupReplicaSet.Id}} {{.DiskBackupReplicaSet.Description}} {{.DiskBackupReplicaSet.Status}}{{else}}{{.DiskBackupShardedClusterSnapshot.Id}} {{.DiskBackupShardedClusterSnapshot.Description}} {{.DiskBackupShardedClusterSnapshot.Status}}{{end}}{{end}}`
3636

3737
type ListOpts struct {
3838
cli.GlobalOpts

internal/cli/atlas/datalakepipelines/availablesnapshots/list_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ func TestListOpts_Run(t *testing.T) {
4040
Results: []atlasv2.DiskBackupSnapshot{
4141
{
4242
DiskBackupReplicaSet: &atlasv2.DiskBackupReplicaSet{
43-
Id: pointer.Get("5e4e593f70dfbf1010295836"),
44-
Status: pointer.Get("IDLE"),
43+
Id: pointer.Get("5e4e593f70dfbf1010295836"),
44+
Description: pointer.Get("test rs"),
45+
Status: pointer.Get("IDLE"),
4546
},
4647
},
4748
{
4849
DiskBackupShardedClusterSnapshot: &atlasv2.DiskBackupShardedClusterSnapshot{
49-
Id: pointer.Get("5e4e593f70dfbf1010295638"),
50-
Status: pointer.Get("IDLE"),
50+
Id: pointer.Get("5e4e593f70dfbf1010295638"),
51+
Description: pointer.Get("test cluster"),
52+
Status: pointer.Get("IDLE"),
5153
},
5254
},
5355
},
@@ -79,9 +81,9 @@ func TestListOpts_Run(t *testing.T) {
7981
t.Fatalf("Run() unexpected error: %v", err)
8082
}
8183

82-
assert.Equal(t, `ID STATUS
83-
5e4e593f70dfbf1010295836 IDLE
84-
5e4e593f70dfbf1010295638 IDLE`, buf.String())
84+
assert.Equal(t, `ID DESCRIPTION STATUS
85+
5e4e593f70dfbf1010295836 test rs IDLE
86+
5e4e593f70dfbf1010295638 test cluster IDLE`, buf.String())
8587
t.Log(buf.String())
8688
}
8789

internal/cli/atlas/datalakepipelines/data_lake_pipelines.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package datalakepipelines
1919
import (
2020
"github.com/mongodb/mongodb-atlas-cli/internal/cli"
2121
"github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/datalakepipelines/availableschedules"
22+
"github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/datalakepipelines/availablesnapshots"
2223
"github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/datalakepipelines/datasets"
2324
"github.com/mongodb/mongodb-atlas-cli/internal/cli/atlas/datalakepipelines/runs"
2425
"github.com/spf13/cobra"
@@ -51,8 +52,7 @@ func Builder() *cobra.Command {
5152
WatchBuilder(),
5253
runs.Builder(),
5354
availableschedules.Builder(),
54-
// TODO renable this once CLOUDP-178195 is fixed
55-
// availablesnapshots.Builder(),
55+
availablesnapshots.Builder(),
5656
datasets.Builder(),
5757
)
5858

internal/cli/atlas/datalakepipelines/data_lake_pipelines_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestBuilder(t *testing.T) {
2828
test.CmdValidator(
2929
t,
3030
Builder(),
31-
12,
31+
13,
3232
[]string{},
3333
)
3434
}

test/e2e/atlas/data_lake_pipelines_test.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -338,25 +338,24 @@ func TestDataLakePipelines(t *testing.T) {
338338
}
339339
})
340340

341-
// TODO renable this once CLOUDP-178195 is fixed
342-
// t.Run("AvailableSnapshots List", func(t *testing.T) {
343-
// cmd := exec.Command(cliPath,
344-
// datalakePipelineEntity,
345-
// "availablesnapshots",
346-
// "ls",
347-
// "--pipeline", pipelineName,
348-
// "--projectId", g.projectID,
349-
// "-o=json")
350-
// cmd.Env = os.Environ()
351-
// resp, err := cmd.CombinedOutput()
352-
// req.NoError(err, string(resp))
353-
354-
// var r *atlasv2.PaginatedBackupSnapshot
355-
// a := assert.New(t)
356-
// if err = json.Unmarshal(resp, &r); a.NoError(err) {
357-
// a.NotEmpty(r)
358-
// }
359-
// })
341+
t.Run("AvailableSnapshots List", func(t *testing.T) {
342+
cmd := exec.Command(cliPath,
343+
datalakePipelineEntity,
344+
"availablesnapshots",
345+
"ls",
346+
"--pipeline", pipelineName,
347+
"--projectId", g.projectID,
348+
"-o=json")
349+
cmd.Env = os.Environ()
350+
resp, err := cmd.CombinedOutput()
351+
req.NoError(err, string(resp))
352+
353+
var r *atlasv2.PaginatedBackupSnapshot
354+
a := assert.New(t)
355+
if err = json.Unmarshal(resp, &r); a.NoError(err) {
356+
a.NotEmpty(r)
357+
}
358+
})
360359

361360
t.Run("Delete", func(t *testing.T) {
362361
cmd := exec.Command(cliPath,

0 commit comments

Comments
 (0)